Archives For November 30, 1999


Consider this scenario: You create a new web and add several apps. Next, you make some master page modifications and choose the “Reset All Subsites” option when applying the master page. This prompts SharePoint to reset all MasterUrl and CustomMasterUrl properties to point to the root web. Because all of our apps are running in their own App-Web (Aka sub-site) these sites are reset too. So now when are apps are rendered the master page it calling to the root web for its masterpage. This results in error because the app is not allowed to call outside of its own web. (Some scenarios allow cross-site calls).

 

To fix this we need to rewrite the app master page URL. We can do this for all apps using PowerShell.


$appWebs = (Get-SPSite -Identity <YourSiteCollectionURL> -Limit All).AllWebs | ?{$_.Url -match "<YourAppURL>"} #Your app URL should be company-app.com, etc
foreach ($app in $appWebs) {
$masterUrl = $app.ServerRelativeUrl + "/_catalogs/masterpage/Seattle.master"
$app.MasterUrl = $masterUrl
$app.Update()
}

We can now access the configuration pages within our apps.

 

{Kam}


Need to cycle IIS on all of your SharePoint servers? There are a couple ways to do it in 1-2 lines of PowerShell.

Option 1 (Requires SharePoint Admin shell or the Microsoft.SharePoint.PowerShell add in to be loaded)

Get-SPServer | ?{$_.Role -ne "Invalid"} | %{iisreset $_.Address}

Option 2 (Can be run from any POSH shell)

$servers = @("sp1","sp2","sp3")
$servers | %{iisreset $_}

Option 2 requires that you put your servers into an array manually. This could also be run on a single line.

$servers = @("sp1","sp2","sp3"); $servers | %{iisreset $_}

Happy POSHing!

Great post on how to use POSH and CSOM to work with SharePoint Online!!