Skip to content

New NotionFile

fasteiner edited this page Jun 19, 2025 · 1 revision

New-NotionFile

SYNOPSIS

Externals a new Notion file object.

SYNTAX

TypeOnly (Default)

New-NotionFile -Type <String> [<CommonParameters>]

External

New-NotionFile -Type <String> [-Name <String>] -Url <String> 
 [<CommonParameters>]

TypeNameCaption

New-NotionFile -Type <String> -Name <String> -Caption <Object> 
 [<CommonParameters>]

TypeAndName

New-NotionFile -Type <String> -Name <String> [<CommonParameters>]

File

New-NotionFile [-ExpiryTime <Object>] [<CommonParameters>]

DESCRIPTION

This function creates a new instance of the notion_file class. You can create a file object with just a type, with type and name, or with type, name, and caption. For hosted or external files, use the static External method with all parameters.

EXAMPLES

EXAMPLE 1

New-NotionFile -Type 'file'

EXAMPLE 2

New-NotionFile -Type 'external' -Name 'example.txt'

EXAMPLE 3

New-NotionFile -Type 'file' -Name 'example.txt' -Caption 'My Caption'

EXAMPLE 4

New-NotionFile -Type 'file' -Name 'example.txt' -Caption 'My Caption' -Url 'https://example.com/file.txt' -ExpiryTime '2025-12-31T23:59:59Z'

PARAMETERS

-Caption

The caption (rich_text[] or object) for the file.

Type: Object
Parameter Sets: TypeNameCaption
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ExpiryTime

The expiry time for hosted files (optional).

Type: Object
Parameter Sets: File
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

The name of the file.

Type: String
Parameter Sets: External
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: String
Parameter Sets: TypeNameCaption, TypeAndName
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Type

The file type (notion_filetype), e.g. 'file' or 'external'.

Type: String
Parameter Sets: TypeOnly, External, TypeNameCaption, TypeAndName
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Url

The URL of the file (for hosted or external files).

Type: String
Parameter Sets: External
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

notion_file

NOTES

RELATED LINKS

Notion Module

Home
Module-FAQ
SetupOfIntegration

Commands
Classes
Enums

Clone this wiki locally