Get-PnPFolder

Return a folder object

Syntax

Get-PnPFolder
   -Url <String>
                [-Includes <String[]>]
                [-Web <WebPipeBind>]
                [-Connection <SPOnlineConnection>]

Description

Retrieves a folder if it exists. Use Ensure-PnPFolder to create the folder if it does not exist.

Examples

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

Get-PnPFolder -Url "Shared Documents"

Returns the folder called 'Shared Documents' which is located in the root of the current web

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

Get-PnPFolder -Url "/sites/demo/Shared Documents"

Returns the folder called 'Shared Documents' which is located in the root of the current web

Required Parameters

-Url

Site or server relative URL of the folder to retrieve. In the case of a server relative url, make sure that the url starts with the managed path as the current web.

Type:String
Aliases:RelativeUrl
Position:0
Accept pipeline input:True
Accept wildcard characters:False

Optional Parameters

-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:SPOnlineConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Includes

Specify properties to include when retrieving objects from the server.

Type:String[]
Position:0
Accept pipeline input:False
Accept wildcard characters:False
-Web

The web to apply the command to. Omit this parameter to use the current web.

Type:WebPipeBind
Position:Named
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.SharePoint.Client.Folder