|
| 1 | +--- |
| 2 | +Module Name: PnP.PowerShell |
| 3 | +schema: 2.0.0 |
| 4 | +applicable: SharePoint Online |
| 5 | +online version: https://pnp.github.io/powershell/cmdlets/Get-PnPEntraIDAppFilePermission.html |
| 6 | +external help file: PnP.PowerShell.dll-Help.xml |
| 7 | +title: Get-PnPEntraIDAppFilePermission |
| 8 | +--- |
| 9 | + |
| 10 | +# Get-PnPEntraIDAppFilePermission |
| 11 | + |
| 12 | +## SYNOPSIS |
| 13 | + |
| 14 | +**Required Permissions** |
| 15 | + |
| 16 | + * Microsoft Graph API: Files.ReadWrite.All or Sites.ReadWrite.All |
| 17 | + |
| 18 | +Returns Entra ID App permissions for a file in a document library. |
| 19 | + |
| 20 | +## SYNTAX |
| 21 | + |
| 22 | +### All Permissions |
| 23 | +```powershell |
| 24 | +Get-PnPEntraIDAppFilePermission -List <String> [-Path <String>] [-FileId <String>] [-Site <SitePipeBind>] [-Connection <PnPConnection>] |
| 25 | +``` |
| 26 | + |
| 27 | +### By Permission Id |
| 28 | +```powershell |
| 29 | +Get-PnPEntraIDAppFilePermission -PermissionId <String> -List <String> [-Path <String>] [-FileId <String>] [-Site <SitePipeBind>] [-Connection <PnPConnection>] |
| 30 | +``` |
| 31 | + |
| 32 | +### By App Display Name or App Id |
| 33 | +```powershell |
| 34 | +Get-PnPEntraIDAppFilePermission -AppIdentity <String> -List <String> [-Path <String>] [-FileId <String>] [-Site <SitePipeBind>] [-Connection <PnPConnection>] |
| 35 | +``` |
| 36 | + |
| 37 | +## DESCRIPTION |
| 38 | + |
| 39 | +This cmdlet returns app permissions for a file in a document library. It is used in conjunction with the Entra ID SharePoint application permission `Files.SelectedOperations.Selected`. |
| 40 | + |
| 41 | +The file can be identified by either: |
| 42 | +- `-Path`: the path to the file relative to the document library root (e.g. `Folder/SubFolder/file.docx`) |
| 43 | +- `-FileId`: the Graph drive item ID of the file |
| 44 | + |
| 45 | +Exactly one of `-Path` or `-FileId` must be specified. |
| 46 | + |
| 47 | +## EXAMPLES |
| 48 | + |
| 49 | +### EXAMPLE 1 |
| 50 | +```powershell |
| 51 | +Get-PnPEntraIDAppFilePermission -List "Documents" -Path "Contracts/2024/Agreement.docx" |
| 52 | +``` |
| 53 | + |
| 54 | +Returns all app permissions set on the file at the given path in the Documents library of the currently connected site. |
| 55 | + |
| 56 | +### EXAMPLE 2 |
| 57 | +```powershell |
| 58 | +Get-PnPEntraIDAppFilePermission -List "Documents" -Path "Report.xlsx" -Site https://contoso.sharepoint.com/sites/finance |
| 59 | +``` |
| 60 | + |
| 61 | +Returns all app permissions set on the file at the root of the Documents library on the specified site. |
| 62 | + |
| 63 | +### EXAMPLE 3 |
| 64 | +```powershell |
| 65 | +Get-PnPEntraIDAppFilePermission -List "Documents" -FileId "01ABC123DEF456GHI789" |
| 66 | +``` |
| 67 | + |
| 68 | +Returns all app permissions set on the file with the specified drive item ID. |
| 69 | + |
| 70 | +### EXAMPLE 4 |
| 71 | +```powershell |
| 72 | +Get-PnPEntraIDAppFilePermission -List "Documents" -Path "Report.xlsx" -PermissionId aTowaS50fG1zLnNwLmV4dHxlMzhjZmIzMS00 |
| 73 | +``` |
| 74 | + |
| 75 | +Returns the specific permission details for the given permission id on the file. |
| 76 | + |
| 77 | +### EXAMPLE 5 |
| 78 | +```powershell |
| 79 | +Get-PnPEntraIDAppFilePermission -List "Documents" -Path "Report.xlsx" -AppIdentity "My App" |
| 80 | +``` |
| 81 | + |
| 82 | +Returns the specific permission details for the app with the provided display name on the file. |
| 83 | + |
| 84 | +### EXAMPLE 6 |
| 85 | +```powershell |
| 86 | +Get-PnPEntraIDAppFilePermission -List "Documents" -Path "Report.xlsx" -AppIdentity "89ea5c94-7736-4e25-95ad-3fa95f62b66e" |
| 87 | +``` |
| 88 | + |
| 89 | +Returns the specific permission details for the app with the provided app id on the file. |
| 90 | + |
| 91 | +## PARAMETERS |
| 92 | + |
| 93 | +### -AppIdentity |
| 94 | +Specify either the display name or the app id (client id) to filter the returned permissions to a specific app. |
| 95 | + |
| 96 | +```yaml |
| 97 | +Type: String |
| 98 | +Parameter Sets: By App Display Name or App Id |
| 99 | + |
| 100 | +Required: True |
| 101 | +Position: Named |
| 102 | +Default value: None |
| 103 | +Accept pipeline input: False |
| 104 | +Accept wildcard characters: False |
| 105 | +``` |
| 106 | +
|
| 107 | +### -Connection |
| 108 | +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. |
| 109 | +
|
| 110 | +```yaml |
| 111 | +Type: PnPConnection |
| 112 | +Parameter Sets: (All) |
| 113 | + |
| 114 | +Required: False |
| 115 | +Position: Named |
| 116 | +Default value: None |
| 117 | +Accept pipeline input: False |
| 118 | +Accept wildcard characters: False |
| 119 | +``` |
| 120 | +
|
| 121 | +### -FileId |
| 122 | +The Graph drive item ID of the file. Use this as an alternative to `-Path` when you already know the drive item ID. Mutually exclusive with `-Path`. |
| 123 | + |
| 124 | +```yaml |
| 125 | +Type: String |
| 126 | +Parameter Sets: (All) |
| 127 | +
|
| 128 | +Required: False |
| 129 | +Position: Named |
| 130 | +Default value: None |
| 131 | +Accept pipeline input: False |
| 132 | +Accept wildcard characters: False |
| 133 | +``` |
| 134 | + |
| 135 | +### -List |
| 136 | +The document library containing the file. Accepts a list GUID or display name. |
| 137 | + |
| 138 | +```yaml |
| 139 | +Type: String |
| 140 | +Parameter Sets: (All) |
| 141 | +
|
| 142 | +Required: True |
| 143 | +Position: Named |
| 144 | +Default value: None |
| 145 | +Accept pipeline input: False |
| 146 | +Accept wildcard characters: False |
| 147 | +``` |
| 148 | + |
| 149 | +### -Path |
| 150 | +The path to the file relative to the document library root (e.g. `Folder/SubFolder/file.docx` or just `file.docx` for a file at the root). Mutually exclusive with `-FileId`. |
| 151 | + |
| 152 | +```yaml |
| 153 | +Type: String |
| 154 | +Parameter Sets: (All) |
| 155 | +
|
| 156 | +Required: False |
| 157 | +Position: Named |
| 158 | +Default value: None |
| 159 | +Accept pipeline input: False |
| 160 | +Accept wildcard characters: False |
| 161 | +``` |
| 162 | + |
| 163 | +### -PermissionId |
| 164 | +If specified, the permission with that id will be retrieved. |
| 165 | + |
| 166 | +```yaml |
| 167 | +Type: String |
| 168 | +Parameter Sets: By Permission Id |
| 169 | +
|
| 170 | +Required: True |
| 171 | +Position: Named |
| 172 | +Default value: None |
| 173 | +Accept pipeline input: False |
| 174 | +Accept wildcard characters: False |
| 175 | +``` |
| 176 | + |
| 177 | +### -Site |
| 178 | +Optional url of a site to retrieve the permissions for. Defaults to the currently connected site. |
| 179 | + |
| 180 | +```yaml |
| 181 | +Type: SitePipeBind |
| 182 | +Parameter Sets: (All) |
| 183 | +
|
| 184 | +Required: False |
| 185 | +Position: Named |
| 186 | +Default value: Currently connected site |
| 187 | +Accept pipeline input: False |
| 188 | +Accept wildcard characters: False |
| 189 | +``` |
| 190 | + |
| 191 | +## RELATED LINKS |
| 192 | + |
| 193 | +[Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) |
0 commit comments