Web Solutions/Intranets

SharePoint 2013 – Accessing referenced file from is not allowed because the reference is outside of the App Web

Scenario

I ran into this when deploying an event receiver that would update the master page of all sites (SPWeb objects) when activated in a particular site collection (SPSite object).
Accessing referenced file from is not allowed because the reference is outside of the App Web.

Problem

Better Resolution

I adapted this script to something a bit more readily reusable:  https://github.com/skaggej/powershell/blob/master/Set-SPAppWebMasterPages.ps1.  Just enter the root URL of a site collection and it will update the master pages for all app webs within it.

Leave a Reply