### Get-PnPSiteScriptFromWeb Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPSiteScriptFromWeb.html Examples demonstrating different parameter combinations for generating site scripts. ```powershell Get-PnPSiteScriptFromWeb -IncludeAll ``` ```powershell Get-PnPSiteScriptFromWeb -Url "https://contoso.sharepoint.com/sites/teamsite" -IncludeAll ``` ```powershell Get-PnPSiteScriptFromWeb -Url "https://contoso.sharepoint.com/sites/teamsite" -IncludeAll -Lists "Shared Documents","Lists\MyList" ``` ```powershell Get-PnPSiteScriptFromWeb -Url "https://contoso.sharepoint.com/sites/teamsite" -IncludeBranding -IncludeLinksToExportedItems ``` ```powershell Get-PnPSiteScriptFromWeb -IncludeAllLists ``` ```powershell Get-PnPSiteScriptFromWeb -IncludeAllLists | Add-PnPSiteScript -Title "My Site Script" | Add-PnPSiteDesign -Title "My Site Design" -WebTemplate TeamSite ``` -------------------------------- ### Move-PnPTermSet Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Move-PnPTermSet.html Examples demonstrating how to move a term set using either its unique identifier (GUID) or its name. ```powershell Move-PnPTermSet -Identity 81e0a4b8-701d-459c-ad61-a1c7a81810ff -TermGroup 17e16b98-a8c2-4db6-a860-5c42dbc818f4 -TargetTermGroup cf33d1cd-42d8-431c-9e43-3d8dab9ea8fd ``` ```powershell Move-PnPTermSet -Identity "OperationLevel-1 Test" -TermGroup "FromPowerAutomate" -TargetTermGroup "TargetTermGroup" ``` -------------------------------- ### Parameter configuration examples Source: https://pnp.github.io/powershell/cmdlets/Add-PnPPageWebPart.html Examples of parameter definitions for the cmdlet. ```powershell Type: Int32 Parameter Sets: Positioned with built-in web part, Positioned with 3rd party web part Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ```powershell Type: PageComponentPipeBind Parameter Sets: Default with 3rd party web part, Positioned with 3rd party web part Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ```powershell Type: PnPConnection Parameter Sets: (All) Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ```powershell Type: DefaultClientSideWebParts Parameter Sets: Default with built-in web part, Positioned with built-in web part Accepted values: ThirdParty, ContentRollup, BingMap, ContentEmbed, DocumentEmbed, Image, ImageGallery, LinkPreview, NewsFeed, NewsReel, News, PowerBIReportEmbed, QuickChart, SiteActivity, VideoEmbed, YammerEmbed, Events, GroupCalendar, Hero, List, PageTitle, People, QuickLinks, CustomMessageRegion, Divider, MicrosoftForms, Spacer, ClientWebPart, PowerApps, CodeSnippet, PageFields, Weather, YouTube, MyDocuments, YammerFullFeed, CountDown, ListProperties, MarkDown, Planner, Sites, CallToAction, Button Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ```powershell Type: Int32 Parameter Sets: (All) Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ```powershell Type: PagePipeBind Parameter Sets: (All) Required: True Position: 0 Default value: None Accept pipeline input: True (ByValue) Accept wildcard characters: False ``` ```powershell Type: Int32 Parameter Sets: Positioned with built-in web part, Positioned with 3rd party web part Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ```powershell Type: PropertyBagPipeBind Parameter Sets: (All) Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ``` -------------------------------- ### Get-PnPChangeLog Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPChangeLog.html Common usage examples for retrieving changelogs. ```powershell Get-PnPChangeLog ``` ```powershell Get-PnPChangeLog -Nightly ``` ```powershell Get-PnPChangeLog -Version 2.12.0 ``` -------------------------------- ### Install DocFX Source: https://pnp.github.io/powershell/articles/buildingdocumentation.html Create a tools directory and install the specified version of DocFX. ```bash mkdir -p .tools dotnet tool install docfx --tool-path ./.tools --version 2.78.5 __ ``` -------------------------------- ### Set-PnPAvailablePageLayouts Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Set-PnPAvailablePageLayouts.html Examples showing the different ways to configure page layouts using the cmdlet. ```powershell Set-PnPAvailablePageLayouts -PageLayouts [-Connection ] ``` ```powershell Set-PnPAvailablePageLayouts [-AllowAllPageLayouts] [-Connection ] ``` ```powershell Set-PnPAvailablePageLayouts [-InheritPageLayouts] [-Connection ] ``` ```powershell Set-PnPAvailablePageLayouts -AllowAllPageLayouts ``` -------------------------------- ### Get-PnPAccessToken Usage Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPAccessToken.html Practical examples for retrieving tokens for various services and viewing token details. ```powershell Get-PnPAccessToken ``` ```powershell Get-PnPAccessToken -Decoded ``` ```powershell Get-PnPAccessToken -ResourceTypeName SharePoint ``` ```powershell Get-PnPAccessToken -ResourceTypeName ARM ``` ```powershell Get-PnPAccessToken -ResourceUrl "https://management.azure.com/.default" ``` ```powershell Get-PnPAccessToken -ListPermissionScopes ``` -------------------------------- ### Add-PnPListItemAttachment Usage Examples Source: https://pnp.github.io/powershell/cmdlets/Add-PnPListItemAttachment.html Practical examples demonstrating how to attach files from a local path, text content, or a stream. ```powershell Add-PnPListItemAttachment -List "Demo List" -Identity 1 -Path c:\temp\test.mp4 ``` ```powershell Add-PnPListItemAttachment -List "Demo List" -Identity 1 -FileName "test.txt" -Content '{ "Test": "Value" }' ``` ```powershell Add-PnPListItemAttachment -List "Demo List" -Identity 1 -FileName "test.mp4" -Stream $fileStream ``` -------------------------------- ### Install app via pipeline Source: https://pnp.github.io/powershell/cmdlets/Install-PnPApp.html Installs an app by piping the output of Get-PnPApp into the Install-PnPApp cmdlet. ```powershell Get-PnPApp -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe | Install-PnPApp ``` ```powershell Get-PnPApp -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe -Scope Site | Install-PnPApp ``` -------------------------------- ### Convert-PnPFile Usage Examples Source: https://pnp.github.io/powershell/cmdlets/Convert-PnPFile.html Practical examples demonstrating file conversion to memory streams, local paths, and SharePoint folders with various parameters. ```powershell Convert-PnPFile -Url "/sites/demo/Shared Documents/Document.docx" -AsMemoryStream ``` ```powershell Convert-PnPFile -Url "/sites/demo/Shared Documents/Document.docx" ``` ```powershell Convert-PnPFile -Url "/sites/demo/Shared Documents/Document.docx" -Path "C:\Temp" ``` ```powershell Convert-PnPFile -Url "/sites/demo/Shared Documents/Document.docx" -Path "C:\Temp" -Force ``` ```powershell Convert-PnPFile -Url "/sites/demo/Shared Documents/Test/Book.xlsx" -Folder "/sites/demo/Shared Documents/Archive" ``` ```powershell Convert-PnPFile -Url "/sites/demo/Shared Documents/Test/Book.png" -ConvertToFormat Jpg -Folder "/sites/demo/Shared Documents/Archive" ``` ```powershell Convert-PnPFile -Url "/sites/demo/Shared Documents/Test/Book.xlsx" -Folder "/sites/demo/Shared Documents/Archive" -NewFileName "differentname.pdf" ``` -------------------------------- ### Copy-PnPList Usage Examples Source: https://pnp.github.io/powershell/cmdlets/Copy-PnPList.html Practical examples demonstrating how to copy lists using different identifiers and destination configurations. ```powershell Copy-PnPList -Identity "My List" -Title "Copy of My List" ``` ```powershell Copy-PnPList -Identity "My List" -DestinationWebUrl https://contoso.sharepoint.com/sites/hrdepartment ``` ```powershell Copy-PnPList -Identity "My List" -DestinationWebUrl https://contoso.sharepoint.com/sites/hrdepartment -Title "My copied list" ``` ```powershell $list = Get-PnPList -Identity "My List" Copy-PnPList -Identity $list -Title "My copied list" ``` ```powershell Get-PnPList | ? Title -like "*Test*" | Copy-PnPList -DestinationWebUrl https://contoso.sharepoint.com/sites/hrdepartment ``` ```powershell Copy-PnPList -SourceListUrl https://contoso.sharepoint.com/sites/templates/lists/mylist -Verbose -DestinationWebUrl https://contoso.sharepoint.com/sites/hrdepartment\ ``` -------------------------------- ### Serve documentation site Source: https://pnp.github.io/powershell/articles/buildingdocumentation.html Start a local server to preview the generated documentation. ```bash ./.tools/docfx serve ./pages/_site --port 8080 __ ``` -------------------------------- ### Get App Info by Name Source: https://pnp.github.io/powershell/cmdlets/Get-PnPAppInfo.html Retrieves installed applications that match the specified name string. ```powershell Get-PnPAppInfo -Name "Excel Service" ``` -------------------------------- ### Get-PnPBrandCenterFontPackage Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPBrandCenterFontPackage.html Common usage examples for retrieving font packages by default, by store, or by specific identity. ```powershell Get-PnPBrandCenterFontPackage ``` ```powershell Get-PnPBrandCenterFontPackage -Store Site ``` ```powershell Get-PnPBrandCenterFontPackage -Identity "My awesome font" ``` ```powershell Get-PnPBrandCenterFontPackage -Identity "2812cbd8-7176-4e45-8911-6a063f89a1f1" ``` -------------------------------- ### Set-PnPPropertyBagValue Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Set-PnPPropertyBagValue.html Examples demonstrating how to set or add property bag values for the current web or specific folders. ```powershell Set-PnPPropertyBagValue -Key MyKey -Value MyValue ``` ```powershell Set-PnPPropertyBagValue -Key MyKey -Value MyValue -Folder / ``` ```powershell Set-PnPPropertyBagValue -Key MyKey -Value MyValue -Folder /MyFolder ``` -------------------------------- ### Install Docker on Linux Source: https://pnp.github.io/powershell/articles/docker.html Install Docker using the official convenience script and add the current user to the docker group. ```bash bash <(curl -s https://get.docker.com/) sudo usermod -aG docker $USER newgrp docker ``` -------------------------------- ### Add-PnPFile -Values Parameter Examples Source: https://pnp.github.io/powershell/cmdlets/Add-PnPFile.html Examples demonstrating how to format the -Values hashtable for different SharePoint field types. ```PowerShell -Values @{"Title" = "Title New"} ``` ```PowerShell -Values @{"MultiText" = "New text\n\nMore text"} ``` ```PowerShell -Values @{"MultiText" = "New text"} ``` ```PowerShell -Values @{"Choice" = "Value 1"} ``` ```PowerShell -Values @{"Number" = "10"} ``` ```PowerShell -Values @{"Currency" = "10"} ``` ```PowerShell -Values @{"DateAndTime" = "04/20/2023 14:16"} ``` ```PowerShell -Values @{"Lookup" = "2"} ``` ```PowerShell -Values @{"MultiLookupField" = "1","2"} ``` ```PowerShell -Values @{"MultiLookupField" = 1,2} ``` ```PowerShell -Values @{"MultiLookupField" = "1,2"} ``` ```PowerShell -Values @{"YesNo" = $false} ``` ```PowerShell -Values @{"Person" = "user1@domain.com","21"} ``` ```PowerShell -Values @{"MetadataField" = "CORPORATE|DEPARTMENTS|FINANCE"} ``` ```PowerShell -Values @{"MetadataField" = "fe40a95b-2144-4fa2-b82a-0b3d0299d818"} ``` ```PowerShell -Values @{"MetadataField" = "CORPORATE|DEPARTMENTS|FINANCE","CORPORATE|DEPARTMENTS|HR"} ``` ```PowerShell -Values @{"MetadataField" = "fe40a95b-2144-4fa2-b82a-0b3d0299d818","52d88107-c2a8-4bf0-adfa-04bc2305b593"} ``` ```PowerShell -Values @{"Hyperlink" = "https://github.com/OfficeDev/, OfficePnP"} ``` -------------------------------- ### Add-PnPEntraIDServicePrincipalAppRole Usage Examples Source: https://pnp.github.io/powershell/cmdlets/Add-PnPEntraIDServicePrincipalAppRole.html Practical examples for assigning permissions to service principals using object IDs, names, or piped input. ```powershell Add-PnPEntraIDServicePrincipalAppRole -Principal "62614f96-cb78-4534-bf12-1f6693e8237c" -AppRole "Directory.Read.All" -BuiltInType MicrosoftGraph ``` ```powershell Get-PnPEntraIDServicePrincipal -BuiltInType SharePointOnline | Get-PnPEntraIDServicePrincipalAvailableAppRole -Identity "Sites.FullControl.All" | Add-PnPEntraIDServicePrincipalAppRole -Principal "62614f96-cb78-4534-bf12-1f6693e8237c" ``` ```powershell Get-PnPEntraIDServicePrincipal -BuiltInType MicrosoftGraph | Get-PnPEntraIDServicePrincipalAvailableAppRole -Identity "Group.ReadWrite.All" | Add-PnPEntraIDServicePrincipalAppRole -Principal "mymanagedidentity" ``` ```powershell Add-PnPEntraIDServicePrincipalAppRole -Principal "62614f96-cb78-4534-bf12-1f6693e8237c" -AppRole "MyApplication.Read" -Resource "b8c2a8aa-33a0-43f4-a9d3-fe2851c5293e" ``` -------------------------------- ### Get-PnPEntraIDAppListPermission Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPEntraIDAppListPermission.html Common usage patterns for retrieving list permissions based on list names, GUIDs, permission IDs, or application identities. ```powershell Get-PnPEntraIDAppListPermission -List "Documents" ``` ```powershell Get-PnPEntraIDAppListPermission -List "Documents" -Site https://contoso.sharepoint.com/sites/projects ``` ```powershell Get-PnPEntraIDAppListPermission -List "12345678-1234-1234-1234-123456789012" ``` ```powershell Get-PnPEntraIDAppListPermission -List "Documents" -PermissionId aTowaS50fG1zLnNwLmV4dHxlMzhjZmIzMS00 ``` ```powershell Get-PnPEntraIDAppListPermission -List "Documents" -AppIdentity "My App" ``` ```powershell Get-PnPEntraIDAppListPermission -List "Documents" -AppIdentity "89ea5c94-7736-4e25-95ad-3fa95f62b66e" ``` -------------------------------- ### Configure WSL 2 and Install Ubuntu Source: https://pnp.github.io/powershell/articles/docker.html Set the default WSL version to 2 and install the Ubuntu distribution. ```powershell wsl --set-default-version 2 wsl --install --distribution Ubuntu ``` -------------------------------- ### Set-PnPHideDefaultThemes usage examples Source: https://pnp.github.io/powershell/cmdlets/Set-PnPHideDefaultThemes.html Examples demonstrating how to hide or show default themes using the HideDefaultThemes parameter. ```powershell Set-PnPHideDefaultThemes -HideDefaultThemes $true ``` ```powershell Set-PnPHideDefaultThemes -HideDefaultThemes $false ``` -------------------------------- ### Remove-PnPFileVersion Usage Examples Source: https://pnp.github.io/powershell/cmdlets/Remove-PnPFileVersion.html Practical examples for removing specific file versions or all versions. ```PowerShell Remove-PnPFileVersion -Url Documents/MyDocument.docx -Identity 512 ``` ```PowerShell Remove-PnPFileVersion -Url Documents/MyDocument.docx -Identity "Version 1.0" ``` ```PowerShell Remove-PnPFileVersion -Url Documents/MyDocument.docx -All ``` -------------------------------- ### Revoke-PnPEntraIDAppListPermission Examples Source: https://pnp.github.io/powershell/cmdlets/Revoke-PnPEntraIDAppListPermission.html Examples demonstrating how to revoke permissions on a list with and without confirmation prompts, and targeting specific sites. ```powershell Revoke-PnPEntraIDAppListPermission -PermissionId aTowaS50fG1zLnNwLmV4dHxlMzhjZmIzMS00 -List "Documents" ``` ```powershell Revoke-PnPEntraIDAppListPermission -PermissionId aTowaS50fG1zLnNwLmV4dHxlMzhjZmIzMS00 -List "Documents" -Force ``` ```powershell Revoke-PnPEntraIDAppListPermission -PermissionId aTowaS50fG1zLnNwLmV4dHxlMzhjZmIzMS00 -List "Documents" -Site https://contoso.sharepoint.com/sites/projects -Force ``` -------------------------------- ### Get-PnPSiteSearchQueryResults Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPSiteSearchQueryResults.html Various usage examples for retrieving site collections based on templates, titles, or result limits. ```powershell Get-PnPSiteSearchQueryResults ``` ```powershell Get-PnPSiteSearchQueryResults -Query "WebTemplate:STS" ``` ```powershell Get-PnPSiteSearchQueryResults -Query "WebTemplate:SPSPERS" ``` ```powershell Get-PnPSiteSearchQueryResults -Query "Title:Intranet*" ``` ```powershell Get-PnPSiteSearchQueryResults -MaxResults 10 ``` ```powershell Get-PnPSiteSearchQueryResults -All ``` -------------------------------- ### Get-PnPUnifiedGroupMoveState Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPUnifiedGroupMoveState.html Examples demonstrating how to retrieve move state information for a specific group. ```powershell Get-PnPUnifiedGroupMoveState -GroupAlias "contoso-marketing" ``` ```powershell Get-PnPUnifiedGroupMoveState -GroupAlias "contoso-marketing" -Verbose ``` -------------------------------- ### Install DocFX locally Source: https://pnp.github.io/powershell/articles/buildingdocumentation.html Create a local tools directory and install the specific version of DocFX required for the build. ```powershell New-Item -ItemType Directory -Force .\.tools | Out-Null dotnet tool install docfx --tool-path .\.tools --version 2.78.5 ``` -------------------------------- ### Install app by ID Source: https://pnp.github.io/powershell/cmdlets/Install-PnPApp.html Installs an app from the tenant-scoped app catalog using its unique identifier. ```powershell Install-PnPApp -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe ``` -------------------------------- ### Install Docker on Mac OS Source: https://pnp.github.io/powershell/articles/docker.html Install Docker Desktop on Mac OS using Homebrew. ```bash brew install --cask docker ``` -------------------------------- ### Validate tool installations Source: https://pnp.github.io/powershell/articles/buildingdocumentation.html Verify that Git, PowerShell, and .NET SDK are correctly installed. ```bash git --version pwsh --version dotnet --version ``` -------------------------------- ### Get-PnPUserProfilePhoto Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPUserProfilePhoto.html Examples demonstrating how to download a user profile photo to the current folder, with or without a custom filename. ```powershell Get-PnPUserProfilePhoto -Identity "john@contoso.onmicrosoft.com" ``` ```powershell Get-PnPUserProfilePhoto -Identity "john@contoso.onmicrosoft.com" -Filename "john.png" ``` -------------------------------- ### Retrieve Power Platform Environments Source: https://pnp.github.io/powershell/cmdlets/Get-PnPPowerPlatformEnvironment.html Examples of retrieving all, default, or specific environments. ```powershell Get-PnPPowerPlatformEnvironment ``` ```powershell Get-PnPPowerPlatformEnvironment -IsDefault:$true ``` ```powershell Get-PnPPowerPlatformEnvironment -Identity "MyOrganization (default)" ``` -------------------------------- ### Install app from site catalog Source: https://pnp.github.io/powershell/cmdlets/Install-PnPApp.html Installs an app from the site collection-scoped app catalog using its unique identifier. ```powershell Install-PnPApp -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe -Scope Site ``` -------------------------------- ### Install-PnPApp Source: https://pnp.github.io/powershell/cmdlets/Install-PnPApp.html Installs an available app from the app catalog to the current site. ```APIDOC ## Install-PnPApp ### Description Installs an available app from the app catalog to the current site. ### Parameters - **Identity** (AppMetadataPipeBind) - Required - Specifies the Id or an actual app metadata instance. - **Scope** (AppCatalogScope) - Optional - Defines which app catalog to use (Tenant or Site). Defaults to Tenant. - **Wait** (SwitchParameter) - Optional - If specified, the execution will pause until the app has been installed in the site. - **Connection** (PnPConnection) - Optional - Connection to be used by the cmdlet. ### Examples Install-PnPApp -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe Install-PnPApp -Identity 99a00f6e-fb81-4dc7-8eac-e09c6f9132fe -Scope Site ``` -------------------------------- ### Request-PnPReIndexList Example Source: https://pnp.github.io/powershell/cmdlets/Request-PnPReIndexList.html Marks a list named 'Demo List' for full indexing. ```powershell Request-PnPReIndexList -Identity "Demo List" ``` -------------------------------- ### Remove-PnPApplicationCustomizer Examples Source: https://pnp.github.io/powershell/cmdlets/Remove-PnPApplicationCustomizer.html Examples demonstrating how to remove custom actions using either a specific identity or a client-side component ID. ```powershell Remove-PnPApplicationCustomizer -Identity aa66f67e-46c0-4474-8a82-42bf467d07f2 ``` ```powershell Remove-PnPApplicationCustomizer -ClientSideComponentId aa66f67e-46c0-4474-8a82-42bf467d07f2 -Scope web ``` -------------------------------- ### Invoke-PnPGraphMethod Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Invoke-PnPGraphMethod.html These examples demonstrate the different ways to invoke the Microsoft Graph API using the cmdlet, including outputting to the console, a file, a stream, or using batching. ```powershell Invoke-PnPGraphMethod -Url [-AdditionalHeaders GraphAdditionalHeadersPipeBind] [[-Method] ] [-Content ] [-ContentType ] [-ConsistencyLevelEventual] [-Raw] [-All] [-Connection ] [-Verbose] ``` ```powershell Invoke-PnPGraphMethod -Url [-AdditionalHeaders GraphAdditionalHeadersPipeBind] [[-Method] ] [-Content ] [-ContentType ] [-ConsistencyLevelEventual] [-Connection ] [-OutFile ] [-Verbose] ``` ```powershell Invoke-PnPGraphMethod -Url [-AdditionalHeaders GraphAdditionalHeadersPipeBind] [[-Method] ] [-Content ] [-ContentType ] [-ConsistencyLevelEventual] [-Connection ] [-OutStream] [-Verbose] ``` ```powershell Invoke-PnPGraphMethod -Url [-AdditionalHeaders GraphAdditionalHeadersPipeBind] [[-Method] ] [-Content ] [-ContentType ] [-ConsistencyLevelEventual] [-Connection ] [-Batch ] [-Verbose] ``` -------------------------------- ### Get-PnPFileInFolder Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPFileInFolder.html Common usage patterns for listing files in SharePoint folders. ```powershell Get-PnPFileInFolder ``` ```powershell Get-PnPFileInFolder -Recurse ``` ```powershell Get-PnPFileInFolder -Identity "Shared Documents" ``` ```powershell Get-PnPFileInFolder -FolderSiteRelativeUrl "SitePages" -ItemName "Default.aspx" ``` ```powershell Get-PnPFolder -Identity "Shared Documents" | Get-PnPFileInFolder ``` ```powershell Get-PnPFileInFolder -FolderSiteRelativeUrl "SitePages" -Recurse ``` ```powershell Get-PnPFolder -List "Documents" | Get-PnPFileInFolder -Recurse -ExcludeSystemFolders ``` -------------------------------- ### Remove-PnPEntraIDServicePrincipalAppRoleAssignment Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Remove-PnPEntraIDServicePrincipalAppRoleAssignment.html Examples showing the different syntax patterns for removing app role assignments by instance, user, or group. ```powershell Remove-PnPEntraIDServicePrincipalAppRoleAssignment -Identity [-Force] [-Connection ] [-Confirm] [-WhatIf] ``` ```powershell Remove-PnPEntraIDServicePrincipalAppRoleAssignment -User [-AppRole ] [-Resource ] [-Force] [-Connection ] [-Confirm] [-WhatIf] ``` ```powershell Remove-PnPEntraIDServicePrincipalAppRoleAssignment -Group [-AppRole ] [-Resource ] [-Force] [-Connection ] [-Confirm] [-WhatIf] ``` -------------------------------- ### Add-PnPListItem Field Value Examples Source: https://pnp.github.io/powershell/cmdlets/Add-PnPListItem.html Examples of how to format the -Values parameter hashtable for different SharePoint field types. ```powershell Single line of text: -Values @{"Title" = "Title New"} ``` ```powershell Multiple lines of text: -Values @{"MultiText" = "New text\n\nMore text"} ``` ```powershell Rich text: -Values @{"MultiText" = "<strong>New</strong> text"} ``` ```powershell Choice: -Values @{"Choice" = "Choice 1"} ``` ```powershell Multi-Choice: -Values @{"MultiChoice" = "Choice 1","Choice 2"} ``` ```powershell Number: -Values @{"Number" = "10"} ``` ```powershell Currency: -Values @{"Currency" = "10"} ``` ```powershell Date and Time: -Values @{"DateAndTime" = "03/13/2015 14:16"} ``` ```powershell Lookup (id of lookup value): -Values @{"Lookup" = "2"} ``` ```powershell Multi value lookup (id of lookup values as array 1): -Values @{"MultiLookupField" = "1","2"} ``` ```powershell Multi value lookup (id of lookup values as array 2): -Values @{"MultiLookupField" = 1,2} ``` ```powershell Multi value lookup (id of lookup values as string): -Values @{"MultiLookupField" = "1,2"} ``` ```powershell Yes/No: -Values @{"YesNo" = $false} ``` ```powershell Person/Group (id of user/group in Site User Info List or email of the user, separate multiple values with a comma): -Values @{"Person" = "user1@domain.com","21"} ``` ```powershell Managed Metadata (single value with path to term): -Values @{"MetadataField" = "CORPORATE|DEPARTMENTS|FINANCE"} ``` ```powershell Managed Metadata (single value with id of term): -Values @{"MetadataField" = "fe40a95b-2144-4fa2-b82a-0b3d0299d818"} with Id of term ``` ```powershell Managed Metadata (multiple values with paths to terms): -Values @{"MetadataField" = "CORPORATE|DEPARTMENTS|FINANCE","CORPORATE|DEPARTMENTS|HR"} ``` ```powershell Managed Metadata (multiple values with ids of terms): -Values @{"MetadataField" = "fe40a95b-2144-4fa2-b82a-0b3d0299d818","52d88107-c2a8-4bf0-adfa-04bc2305b593"} ``` ```powershell Hyperlink or Picture: -Values @{"Hyperlink" = "https://github.com/OfficeDev/, OfficePnP"} ``` -------------------------------- ### Serve documentation site Source: https://pnp.github.io/powershell/articles/buildingdocumentation.html Start a local web server to preview the generated documentation. ```powershell .\.tools\docfx.exe serve .\pages\_site --port 8080 ``` -------------------------------- ### Set-PnPMultiGeoCompanyAllowedDataLocation Example Source: https://pnp.github.io/powershell/cmdlets/Set-PnPMultiGeoCompanyAllowedDataLocation.html Initiates the setup of a specific multi-geo data location for the tenant. ```powershell Set-PnPMultiGeoCompanyAllowedDataLocation -Location EUR -InitialDomain contoso.onmicrosoft.com ``` -------------------------------- ### Get-PnPFolderItem Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPFolderItem.html These examples demonstrate the different ways to invoke Get-PnPFolderItem using URL, folder pipebind, or list pipebind parameters. ```powershell Get-PnPFolderItem [-FolderSiteRelativeUrl ] [-ItemType ] [-ItemName ] [-Recursive] [-Verbose] [-Connection ] ``` ```powershell Get-PnPFolderItem [-Identity ] [-ItemType ] [-ItemName ] [-Recursive] [-Verbose] [-Connection ] ``` ```powershell Get-PnPFolderItem [-List ] [-ItemType ] [-ItemName ] [-Includes ] [-Verbose] [-Connection ] ``` -------------------------------- ### Get SharePoint Add-ins Source: https://pnp.github.io/powershell/cmdlets/Get-PnPSharePointAddIn.html Retrieves the SharePoint add-ins installed in the current site collection. ```powershell Get-PnPSharePointAddIn ``` -------------------------------- ### Get tenant information by TenantId Source: https://pnp.github.io/powershell/cmdlets/Get-PnPTenantInfo.html Retrieves tenant details using a specific GUID identifier. ```PowerShell Get-PnPTenantInfo -TenantId "e65b162c-6f87-4eb1-a24e-1b37d3504663" ``` -------------------------------- ### Retrieve sites from a tenant sequence Source: https://pnp.github.io/powershell/cmdlets/Get-PnPTenantSequenceSite.html Examples demonstrating how to fetch all sites or a specific site from a provisioning sequence. ```powershell Get-PnPTenantSequenceSite -Sequence $mysequence ``` ```powershell Get-PnPTenantSequenceSite -Sequence $mysequence -Identity 8058ea99-af7b-4bb7-b12a-78f93398041e ``` -------------------------------- ### Get SharePoint Add-ins including Subsites Source: https://pnp.github.io/powershell/cmdlets/Get-PnPSharePointAddIn.html Retrieves the SharePoint add-ins installed in the current site collection and all its subsites. ```powershell Get-PnPSharePointAddIn -IncludeSubsites ``` -------------------------------- ### Get sharing links by unique identifier Source: https://pnp.github.io/powershell/cmdlets/Get-PnPFileSharingLink.html Fetches sharing links for a file using its unique GUID, independent of its location. ```powershell Get-PnPFileSharingLink -Identity eff4c8ca-7b92-4aa2-9744-855611c6ccf2 ``` -------------------------------- ### Retrieve Tenant Themes Source: https://pnp.github.io/powershell/cmdlets/Get-PnPTenantTheme.html Examples demonstrating how to fetch all themes, a specific theme by name, or a theme formatted as JSON. ```powershell Get-PnPTenantTheme ``` ```powershell Get-PnPTenantTheme -Name "MyCompanyTheme" ``` ```powershell Get-PnPTenantTheme -Name "MyCompanyTheme" -AsJson ``` -------------------------------- ### Get status for a specific import job Source: https://pnp.github.io/powershell/cmdlets/Get-PnPUPABulkImportStatus.html Retrieves the status for a specific user profile bulk import job identified by its GUID. ```powershell Get-PnPUPABulkImportStatus -JobId ``` -------------------------------- ### Example: Create a Wiki Page Source: https://pnp.github.io/powershell/cmdlets/Add-PnPWikiPage.html Creates a new wiki page at the specified URL with the provided content. ```powershell Add-PnPWikiPage -PageUrl '/sites/demo1/pages/wikipage.aspx' -Content 'New WikiPage' ``` -------------------------------- ### Get move state by OneDrive Move ID Source: https://pnp.github.io/powershell/cmdlets/Get-PnPUserAndContentMoveState.html Retrieves the move state for a specific OneDrive move job using its unique GUID. ```powershell Get-PnPUserAndContentMoveState -OdbMoveId 8f6f8e3a-2c1f-4d5b-9a7e-6b3c2a1f0e9d ``` -------------------------------- ### Retrieve Site Connections Source: https://pnp.github.io/powershell/cmdlets/Get-PnPSearchSiteConnection.html Examples for listing all connections or retrieving a specific connection by its identity. ```powershell Get-PnPSearchSiteConnection ``` ```powershell Get-PnPSearchSiteConnection -Identity "techcrunch" ``` -------------------------------- ### Retrieve Power Apps Source: https://pnp.github.io/powershell/cmdlets/Get-PnPPowerApp.html Examples demonstrating how to fetch all apps from the default environment or a specific app from a defined environment. ```powershell Get-PnPPowerApp ``` ```powershell Get-PnPPowerApp -Environment (Get-PnPPowerPlatformEnvironment -Identity "myenvironment") -Identity fba63225-baf9-4d76-86a1-1b42c917a182 ``` -------------------------------- ### Retrieve Site Policies Source: https://pnp.github.io/powershell/cmdlets/Get-PnPSitePolicy.html Examples demonstrating how to fetch site policies using different parameters. ```powershell Get-PnPSitePolicy ``` ```powershell Get-PnPSitePolicy -AllAvailable ``` ```powershell Get-PnPSitePolicy -Name "Contoso HBI" ``` -------------------------------- ### DisabledWebPartIds Parameter Source: https://pnp.github.io/powershell/cmdlets/Set-PnPTenant.html Specifies GUIDs of web parts to disable. ```PowerShell Type: Guid[] Parameter Sets: (All) Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False __ ``` -------------------------------- ### AdditionalHeaders Parameter Example Source: https://pnp.github.io/powershell/cmdlets/Invoke-PnPGraphMethod.html Example of providing additional request headers using a Hashtable. ```powershell -AdditionalHeaders @{"If-Match"="234567tysfssdvsadf"} ``` -------------------------------- ### Retrieve Todo Lists Source: https://pnp.github.io/powershell/cmdlets/Get-PnPTodoList.html Examples demonstrating how to fetch Todo lists using various identity and user parameters. ```powershell Get-PnPTodoList ``` ```powershell Get-PnPTodoList -Identity "ABCkAGU4MGE1OTRiLTUzMGEtNDRjZi05ZmVmLWFiMTkyYmQxODRjOQAuAAAAAACQV8RStyZCQJ4ydzjIK5HmAQD2LFcxdwYMRqbupn47nEYYAASUnLfyAAA=" ``` ```powershell Get-PnPTodoList -Identity "Travel items" ``` ```powershell Get-PnPTodoList -User john@doe.com ``` ```powershell Get-PnPTodoList -User john@doe.com -Identity "ABCMkAGU4MGE1OTRiLTUzMGEtNDRjZi05ZmVmLWFiMTkyYmQxODRjOQAuAAAAAACQV8RStyZCQJ4ydzjIK5HmAQD2LFcxdwYMRqbupn47nEYYAASUnLfyAAA=" ``` ```powershell Get-PnPTodoList -User john@doe.com -Identity "Travel items" ``` -------------------------------- ### Configure Versioning Source: https://pnp.github.io/powershell/cmdlets/Set-PnPList.html Examples for enabling and configuring major and minor versioning settings on lists and libraries. ```powershell Set-PnPList -Identity "Demo List" -EnableVersioning $true ``` ```powershell Set-PnPList -Identity "Demo List" -EnableVersioning $true -MajorVersions 20 ``` ```powershell Set-PnPList -Identity "Demo Library" -EnableVersioning $true -EnableMinorVersions $true -MajorVersions 20 -MinorVersions 5 ``` -------------------------------- ### Install modern PnP PowerShell module Source: https://pnp.github.io/powershell/articles/upgrading.html Installs the current PnP.PowerShell module from the PowerShell Gallery. ```powershell Install-Module -Name "PnP.PowerShell" ``` -------------------------------- ### Build documentation site Source: https://pnp.github.io/powershell/articles/buildingdocumentation.html Execute the build script to generate the documentation site. ```powershell .\pages\Build-Site.ps1 -SkipPublish ``` -------------------------------- ### Remove user by GUID Source: https://pnp.github.io/powershell/cmdlets/Remove-PnPEntraIDUser.html Removes a user from Entra ID using their unique identifier (GUID). ```powershell Remove-PnPEntraIDUser -Identity 5a4c547a-1440-4f64-9952-a0c6f1c9e7ea ``` -------------------------------- ### Build documentation site Source: https://pnp.github.io/powershell/articles/buildingdocumentation.html Execute the build script to generate the documentation site. ```powershell pwsh ./pages/Build-Site.ps1 -SkipPublish __ ``` -------------------------------- ### Remove-PnPCustomAction Examples Source: https://pnp.github.io/powershell/cmdlets/Remove-PnPCustomAction.html Examples demonstrating how to remove custom actions by ID, scope, and using pipeline input. ```powershell Remove-PnPCustomAction -Identity aa66f67e-46c0-4474-8a82-42bf467d07f2 ``` ```powershell Remove-PnPCustomAction -Identity aa66f67e-46c0-4474-8a82-42bf467d07f2 -Scope web ``` ```powershell Remove-PnPCustomAction -Identity aa66f67e-46c0-4474-8a82-42bf467d07f2 -Force ``` ```powershell Get-PnPCustomAction -Scope All | ? Location -eq ScriptLink | Remove-PnPCustomAction ``` -------------------------------- ### Get-PnPFile Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPFile.html Various syntax patterns for retrieving files from SharePoint using different output formats. ```powershell Get-PnPFile -Url -AsFileObject [-Connection ] ``` ```powershell Get-PnPFile -Url -AsListItem [-ThrowExceptionIfFileNotFound] [-Connection ] ``` ```powershell Get-PnPFile -Url -AsFile -Path -Filename [-Force] [-Connection ] ``` ```powershell Get-PnPFile -Url -AsString [-Connection ] ``` ```powershell Get-PnPFile -Url -AsMemoryStream [-Connection ] ``` -------------------------------- ### Install Docker on Windows via Chocolatey Source: https://pnp.github.io/powershell/articles/docker.html Use Chocolatey to install the Docker engine on Windows systems. ```powershell iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) choco install -y docker-engine ``` -------------------------------- ### Get-PnPAccessToken Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPAccessToken.html Basic syntax patterns for retrieving access tokens by resource type, URL, or listing scopes. ```powershell Get-PnPAccessToken [-ResourceTypeName] [-Decoded] [-Scopes] [-Connection ] ``` ```powershell Get-PnPAccessToken -ResourceTypeName [-Decoded] [-Scopes] [-Connection ] ``` ```powershell Get-PnPAccessToken -ResourceUrl [-Decoded] [-Scopes] [-Connection ] ``` ```powershell Get-PnPAccessToken -ListPermissionScopes [-ResourceTypeName ] ``` -------------------------------- ### Install Secret Management Modules Source: https://pnp.github.io/powershell/articles/credentialmanagement.html Install the required PowerShell modules to enable vault-based credential storage. ```powershell Install-Module -Name "Microsoft.PowerShell.SecretManagement" Install-Module -Name "Microsoft.PowerShell.SecretStore" ``` -------------------------------- ### Set-PnPDocumentSetField Examples Source: https://pnp.github.io/powershell/cmdlets/Set-PnPDocumentSetField.html Examples demonstrating how to add or remove fields as Shared or Welcome Page fields in a document set. ```powershell Set-PnPDocumentSetField -Field "Test Field" -DocumentSet "Test Document Set" -SetSharedField -SetWelcomePageField ``` ```powershell Set-PnPDocumentSetField -Field "Test Field" -DocumentSet "Test Document Set" -RemoveSharedField -RemoveWelcomePageField ``` -------------------------------- ### Build Documentation on Linux/Mac/WSL Source: https://pnp.github.io/powershell/articles/buildingdocker.html Runs the DocFX build process within a Docker container. ```bash docker run --rm -it -v $(pwd)/pages:/workspace -w /workspace pnp.powershell-pages-build docfx build docfx.json ``` -------------------------------- ### Remove-PnPListItemAttachment Examples Source: https://pnp.github.io/powershell/cmdlets/Remove-PnPListItemAttachment.html Various usage examples for removing attachments, including permanent deletion, recycling, and force operations. ```powershell Remove-PnPListItemAttachment -List "Demo List" -Identity 1 -FileName test.txt ``` ```powershell Remove-PnPListItemAttachment -List "Demo List" -Identity 1 -FileName test.txt -Recycle ``` ```powershell Remove-PnPListItemAttachment -List "Demo List" -Identity 1 -FileName test.txt -Recycle -Force ``` ```powershell Remove-PnPListItemAttachment -List "Demo List" -Identity 1 -All -Recycle -Force ``` ```powershell Remove-PnPListItemAttachment -List "Demo List" -Identity 1 -All ``` -------------------------------- ### Get-PnPFolderInFolder Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPFolderInFolder.html Basic syntax patterns for retrieving folders using URL, pipebind, or list pipebind. ```powershell Get-PnPFolderInFolder [-FolderSiteRelativeUrl ] [-ItemName ] [-ExcludeSystemFolders] [-Includes ] [-Recurse] [-Verbose] [-Connection ] ``` ```powershell Get-PnPFolderInFolder [-Identity ] [-ItemName ] [-ExcludeSystemFolders] [-Includes ] [-Recurse] [-Verbose] [-Connection ] ``` ```powershell Get-PnPFolderInFolder [-List ] [-ItemType ] [-ItemName ] [-Includes ] [-Verbose] [-Connection ] ``` -------------------------------- ### Retrieve apps from the app catalog Source: https://pnp.github.io/powershell/cmdlets/Get-PnPApp.html Examples demonstrating how to list apps from different catalog scopes or retrieve a specific app by its identity. ```powershell Get-PnPApp ``` ```powershell Get-PnPApp -Scope Site ``` ```powershell Get-PnPApp -Identity 2646ccc3-6a2b-46ef-9273-81411cbbb60f ``` -------------------------------- ### Build workflow layout on macOS or Linux Source: https://pnp.github.io/powershell/articles/buildingdocumentation.html Install tools and run the build script within the temporary worktree folder. ```bash cd "$root" mkdir -p .tools dotnet tool install docfx --tool-path ./.tools --version 2.78.5 export PATH="$(pwd)/.tools:$PATH" pwsh ./dev/pages/Build-Site.ps1 __ ``` -------------------------------- ### Retrieve search configuration examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPSearchConfiguration.html Various ways to retrieve search configurations using different scopes and output formats. ```powershell Get-PnPSearchConfiguration ``` ```powershell Get-PnPSearchConfiguration -Scope Site ``` ```powershell Get-PnPSearchConfiguration -Scope Subscription ``` ```powershell Get-PnPSearchConfiguration -Path searchconfig.xml -Scope Subscription ``` ```powershell Get-PnPSearchConfiguration -Scope Site -OutputFormat ManagedPropertyMappings ``` -------------------------------- ### Add-PnPEntraIDServicePrincipalAppRole Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Add-PnPEntraIDServicePrincipalAppRole.html Syntax definitions for adding app roles by built-in type or by specific resource. ```powershell Add-PnPEntraIDServicePrincipalAppRole -Principal -AppRole -BuiltInType [-Connection ] ``` ```powershell Add-PnPEntraIDServicePrincipalAppRole -Principal -AppRole -Resource [-Connection ] ``` -------------------------------- ### Retrieve Microsoft 365 Group setting templates Source: https://pnp.github.io/powershell/cmdlets/Get-PnPMicrosoft365GroupSettingTemplates.html Examples demonstrating how to list all available templates or fetch a specific template by its unique identifier. ```powershell Get-PnPMicrosoft365GroupSettingTemplates ``` ```powershell Get-PnPMicrosoft365GroupSettingTemplates -Identity "08d542b9-071f-4e16-94b0-74abb372e3d9" ``` -------------------------------- ### Install PnP PowerShell Source: https://pnp.github.io/powershell/articles/installation.html Commands to install the latest stable or nightly prerelease versions of the PnP PowerShell module. ```powershell Install-Module PnP.PowerShell ``` ```powershell Install-Module PnP.PowerShell -AllowPrerelease ``` -------------------------------- ### Get-PnPWebAlert usage examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPWebAlert.html Demonstrates various ways to retrieve web alerts, including fetching all alerts or filtering by specific lists and users. ```powershell Get-PnPWebAlert ``` ```powershell Get-PnPWebAlert -ListTitle "Documents" ``` ```powershell Get-PnPWebAlert -ListUrl "Lists/Tasks" -UserName "alex.wilber@contoso.com" ``` ```powershell Get-PnPWebAlert -UserId 12345678-90ab-cdef-1234-567890abcdef ``` -------------------------------- ### Remove-PnPTermLabel Examples Source: https://pnp.github.io/powershell/cmdlets/Remove-PnPTermLabel.html Examples demonstrating how to remove a Swedish label from a term using either a Term ID or a hierarchical path. ```powershell Remove-PnPTermLabel -Label "Marknadsföring" -Lcid 1053 -Term 2d1f298b-804a-4a05-96dc-29b667adec62 ``` ```powershell Remove-PnPTermLabel -Label "Marknadsföring" -Lcid 1053 -Term "Marketing" -TermSet "Departments" -TermGroup "Corporate" ``` -------------------------------- ### Get-PnPRecycleBinItem Syntax Examples Source: https://pnp.github.io/powershell/cmdlets/Get-PnPRecycleBinItem.html Basic syntax patterns for retrieving recycle bin items by identity, stage, or row limit. ```powershell Get-PnPRecycleBinItem [-Identity ] [-Connection ] [-Includes ] ``` ```powershell Get-PnPRecycleBinItem [-FirstStage] [-RowLimit ] [-Connection ] [-Includes ] ``` ```powershell Get-PnPRecycleBinItem [-SecondStage] [-RowLimit ] [-Connection ] [-Includes ] ```