external help file | applicable | schema |
---|---|---|
SharePoint Server 2013, SharePoint Server 2016, SharePoint Online |
2.0.0 |
Downloads a file.
Get-PnPFile -Url <String>
[-Web <WebPipeBind>]
[-Connection <SPOnlineConnection>]
Get-PnPFile -Url <String>
[-AsListItem [<SwitchParameter>]]
[-ThrowExceptionIfFileNotFound [<SwitchParameter>]]
[-Web <WebPipeBind>]
[-Connection <SPOnlineConnection>]
Get-PnPFile -Url <String>
[-AsString [<SwitchParameter>]]
[-Web <WebPipeBind>]
[-Connection <SPOnlineConnection>]
Get-PnPFile -AsFile [<SwitchParameter>]
-Url <String>
[-Path <String>]
[-Filename <String>]
[-Force [<SwitchParameter>]]
[-Web <WebPipeBind>]
[-Connection <SPOnlineConnection>]
PS:> Get-PnPFile -Url /sites/project/_catalogs/themes/15/company.spcolor
Retrieves the file and downloads it to the current folder
PS:> Get-PnPFile -Url /sites/project/_catalogs/themes/15/company.spcolor -Path c:\temp -FileName company.spcolor -AsFile
Retrieves the file and downloads it to c:\temp\company.spcolor
PS:> Get-PnPFile -Url /sites/project/_catalogs/themes/15/company.spcolor -AsString
Retrieves the file and outputs its contents to the console
PS:> Get-PnPFile -Url /sites/project/_catalogs/themes/15/company.spcolor -AsFile
Retrieves the file and returns it as a File object
PS:> Get-PnPFile -Url /sites/project/_catalogs/themes/15/company.spcolor -AsListItem
Retrieves the file and returns it as a ListItem object
PS:> Get-PnPFile -Url _catalogs/themes/15/company.spcolor -Path c:\temp -FileName company.spcolor -AsFile
Retrieves the file by site relative URL and downloads it to c:\temp\company.spcolor
Type: SwitchParameter
Parameter Sets: Save to local path
Required: True
Position: Named
Accept pipeline input: False
Returns the file as a listitem showing all its properties
Type: SwitchParameter
Parameter Sets: Return as list item
Required: False
Position: Named
Accept pipeline input: False
Retrieve the file contents as a string
Type: SwitchParameter
Parameter Sets: Return as string
Required: False
Position: Named
Accept pipeline input: False
Name for the local file
Type: String
Parameter Sets: Save to local path
Required: False
Position: Named
Accept pipeline input: False
Overwrites the file if it exists.
Type: SwitchParameter
Parameter Sets: Save to local path
Required: False
Position: Named
Accept pipeline input: False
Local path where the file should be saved
Type: String
Parameter Sets: Save to local path
Required: False
Position: Named
Accept pipeline input: False
If provided in combination with -AsListItem, a Sytem.ArgumentException will be thrown if the file specified in the -Url argument does not exist. Otherwise it will return nothing instead.
Type: SwitchParameter
Parameter Sets: Return as list item
Required: False
Position: Named
Accept pipeline input: False
The URL (server or site relative) to the file
Type: String
Parameter Sets: Return as file object
Aliases: ServerRelativeUrl,SiteRelativeUrl
Required: True
Position: 0
Accept pipeline input: True
Optional connection to be used by cmdlet. Retrieve the value for this parameter by eiter specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.
Type: SPOnlineConnection
Parameter Sets: (All)
Required: False
Position: Named
Accept pipeline input: False
This parameter allows you to optionally apply the cmdlet action to a subweb within the current web. In most situations this parameter is not required and you can connect to the subweb using Connect-PnPOnline instead. Specify the GUID, server relative url (i.e. /sites/team1) or web instance of the web to apply the command to. Omit this parameter to use the current web.
Type: WebPipeBind
Parameter Sets: (All)
Required: False
Position: Named
Accept pipeline input: False