Add NotionDatabaseProperty - fasteiner/Notion GitHub Wiki


Category: Commands external help file: Notion-help.xml Module Name: Notion online version: https://developers.notion.com/reference/update-property-schema-object schema: 2.0.0 Type: Command

Add-NotionDatabaseProperty

SYNOPSIS

Adds a new property to a Notion database.

SYNTAX

Add-NotionDatabaseProperty [-DatabaseId] <String> -property <Object> -PropertyName <String>
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The `Add-NotionDatabaseProperty` function adds a specified property to a Notion database using the Notion API. You can specify the database ID, the property object, and the name of the property to be added. The function supports pipeline input for adding multiple properties in a single invocation.

EXAMPLES

EXAMPLE 1

Add-NotionDatabaseProperty -DatabaseId "12345abcde" -property @{ type = "title"; title = @{ text = @{ content = "New Title" } } } -PropertyName "Title"

Adds a new title property named "Title" to the database with the ID `12345abcde`.

EXAMPLE 2

@(
    @{ property = @{ type = "number"; number = @{ format = "number" } }; PropertyName = "Score" },
    @{ property = @{ type = "select"; select = @{ options = @(@{ name = "Option 1" }, @{ name = "Option 2" }) } }; PropertyName = "Category" }
) | Add-NotionDatabaseProperty -DatabaseId "12345abcde"

Adds multiple properties (`Score` and `Category`) to the database with the ID `12345abcde` using pipeline input.

EXAMPLE 3

$input = @{
    DatabaseId = "12345abcde"
    property = @{ type = "number"; number = @{ format = "number" } }
    PropertyName = "Score"
}
Add-NotionDatabaseProperty @input

Adds a new number property named "Score" to the database with the ID `12345abcde`.

PARAMETERS

-DatabaseId

The unique identifier of the Notion database where the property will be added. This parameter is mandatory.

Type: String
Parameter Sets: (All)
Aliases: Id

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

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

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

-property

The property object to be added to the database. This parameter is mandatory and accepts input via the pipeline by property name.

Type: Object
Parameter Sets: (All)
Aliases:

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

-PropertyName

The name of the property to be added to the database. This parameter is mandatory and accepts input via the pipeline by property name.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
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_database]

Returns a notion_database object representing the updated Notion database.

NOTES

RELATED LINKS

https://developers.notion.com/reference/update-property-schema-object

⚠️ **GitHub.com Fallback** ⚠️