Posts

SharePoint PnP Management Shell - Permissions Consent

Image
The SharePoint PnP Management Shell is a PowerShell module that is a part of the open-source Microsoft 365 Community projects led by Microsoft Engineers and Microsoft MVPs (e.g. https://github.com/waldekmastykarz , https://github.com/erwinvanhunen ). It complements Microsoft Online SharePoint Management Shell by adding over 500 PowerShell commandlets to query and manage various elements of SharePoint Online, many of which have no equivalents in other tools or in the user interface (e.g. Export-PnPTaxonomy , Get-PnPAvailableClientSideComponents , Get-PnPCustomAction , Get-PnPEventReceiver , Get-PnPJavaScriptLink , Get-PnPSearchConfiguration , Get-PnPSiteTemplate ). However, in order to use the module, it needs to be granted permission consent to the Azure Enterprise Application “ PnP Management Shell ” that is used by default by the module to access Microsoft Graph functionality in the tenant. The following is an example of the types of permissions that are requested: Such pe

Useful SharePoint PowerShell Snippets

SharePoint Update ```PowerShell if($env:USERNAME -notlike "*spfarm*"){     Write-Warning "Please, execute the script as SPFarm account";     return -1; } $thisFile = (Get-Item $PSCommandPath); $logsFolder = "$($thisFile.Directory.Parent.FullName)\Logs"; New-Item $logsFolder -ErrorAction Ignore; Start-Transcript "$($logsFolder)\$(Get-Date -Format 'yyyy-MMdd-HHmm')-$($thisFile.BaseName)-$($env:COMPUTERNAME).log" -IncludeInvocationHeader; try {     try{         Add-PSSnapin Microsoft.SharePoint.PowerShell;         Write-Host "`r`n`r`nUpgrading content databases`r`n`r`n" -ForegroundColor Yellow;         foreach($db in (Get-SPContentDatabase)){             Write-Host "Upgrading DB: $($db)";             Upgrade-SPContentDatabase $db -Confirm:$false -ErrorAction Continue;         }     } catch {         $Error | % { Write-Error $_; };         $Error.Clear();     }     #Install-SPApplication

Changing of SharePoint site favicon: not so easy

SharePoint master pages contain a  SharePoint:SPShortcutIcon  tag that renders out the default SharePoint icon  /_layouts/images/favicon.ico . The icon file is stored in the SharePoint file system hive, and there is no way to change it in a controlled manner other than modifying of the master page or implementing script-based hacks workarounds. Modifying of master page is not the recommended approach for SharePoint Online and there is no CSOM or REST API to replace the hard-coded URL with an URL to an icon file that is relative to a site. It would have been nice if SharePoint architects decided to use the default location of the favicon in the out-of-the-box master pages to a location on the site , like the  {masterpagecatog}  for example, or to add favicon functionality to SharePoint APIs.  BTW, if you decide to try to change to URL location in the master page to use the ~site   or the ~sitecollection   token, you will quickly realize that that it does not work because the tokens d

SharePoint 2016: Discussion Board - My Discussions View - Problem and Workaround

Image
Problem With out-of the box Discussion Board in SharePoint 2016 , when you try to navigate to the My Discussions view, users receive the following error: