Search Results for

    Show / Hide Table of Contents

    Remove-PnPFile

    SYNOPSIS

    Removes a file.

    SYNTAX

    Server Relative

    Remove-PnPFile [-ServerRelativeUrl] <String> [-Recycle] [-Force] [-Connection <PnPConnection>] 
    

    Site Relative

    Remove-PnPFile [-SiteRelativeUrl] <String> [-Recycle] [-Force] [-Connection <PnPConnection>]
    

    DESCRIPTION

    This cmdlet removes the specified file based on the site-relative or server-relative url.

    EXAMPLES

    EXAMPLE 1

    Remove-PnPFile -ServerRelativeUrl /sites/project/_catalogs/themes/15/company.spcolor
    

    Removes the file company.spcolor.

    EXAMPLE 2

    Remove-PnPFile -SiteRelativeUrl _catalogs/themes/15/company.spcolor
    

    Removes the file company.spcolor.

    EXAMPLE 3

    Remove-PnPFile -SiteRelativeUrl _catalogs/themes/15/company.spcolor -Recycle
    

    Removes the file company.spcolor and saves it to the Recycle Bin.

    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: PnPConnection
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -Force

    If provided, no confirmation will be asked to remove the file, but instead it will silently be removed.

    Type: SwitchParameter
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -Recycle

    When provided, the file will be moved to recycle bin. If omitted, the file will be deleted directly.

    Type: SwitchParameter
    Parameter Sets: (All)
    
    Required: False
    Position: Named
    Default value: None
    Accept pipeline input: False
    Accept wildcard characters: False
    

    -ServerRelativeUrl

    Server relative URL of the file.

    Type: String
    Parameter Sets: Server Relative
    
    Required: True
    Position: 0
    Default value: None
    Accept pipeline input: True (ByValue)
    Accept wildcard characters: False
    

    -SiteRelativeUrl

    Site relative URL of the file.

    Type: String
    Parameter Sets: Site Relative
    
    Required: True
    Position: 0
    Default value: None
    Accept pipeline input: True (ByValue)
    Accept wildcard characters: False
    

    RELATED LINKS

    Microsoft 365 Patterns and Practices

    Back to top Generated by DocFX spacer