< Back

New-GDriveItem

Mon Jan 13, 2020 10:26 pm

NAME New-GDriveItem



SYNOPSIS

Creates new GoogleDrive Item, set metadata





SYNTAX

New-GDriveItem -Name <String> [-ParentID <String[]>] -AccessToken <String> [-WhatIf] [-Confirm]

[<CommonParameters>]



New-GDriveItem [-JsonProperty <String>] -AccessToken <String> [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

Creates new GoogleDrive Item, set metadata





PARAMETERS

-Name <String>

Name of an item to be created



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ParentID <String[]>

Folder ID(s) in which new item will be placed



Required? false

Position? named

Default value @('root')

Accept pipeline input? false

Accept wildcard characters? false



-JsonProperty <String>

Json-formatted string with all needed file metadata



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AccessToken <String>

Access Token for request



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

Json with item metadata as PSObject





NOTES





Author: Max Kozlov



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>#Name based creation



New-GDriveItem -AccessToken $access_token -Name 'test.txt' -ParentID 'root'









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>#Metadata based creation



New-GDriveItem -AccessToken $access_token -JsonProperty '{ "name": "test.txt", "parents": ["root"] }'











RELATED LINKS

New-GDriveFolder

Add-GDriveItem

Set-GDriveItemProperty

Set-GDriveItemContent

https://developers.google.com/drive/api ... les/create