Issue
If you’re trying to debug a mapped custom page in SharePoint from PowerShell, but come across this issue:
PS C:> $webapp = get-spwebapplication http://sp2010 $webapp.GetMappedPage([Microsoft.SharePoint.Administration.SPWebApplication.SPCustomPage]::Error) Unable to find type [Microsoft.SharePoint.Administration.SPWebApplication.SPCustomPage]: make sure that the assembly containing this type is loaded. At line:2 char:90 + $webapp.GetMappedPage([Microsoft.SharePoint.Administration.SPWebApplication.SPCustomPage] <<<< ::Error) + CategoryInfo : InvalidOperation: (Microsoft.Share...on.SPCustomPage:String) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound
Solution
Try this instead:
$webapp.GetMappedPage([Microsoft.SharePoint.Administration.SPWebApplication+SPCustomPage]::Signout)
The Clue
I’m not sure why the syntax is different for this. I would have expected a period instead of a plus there before SPCustomPage. None of my research on Enums showed a plus sign, but finally I noticed this:
PS C:> $webapp.GetMappedPage MemberType : Method OverloadDefinitions : {string GetMappedPage(Microsoft.SharePoint.Administration.SPWebApplication+SPCustomPage key), string GetMappedPage(string page)} TypeNameOfValue : System.Management.Automation.PSMethod Value : string GetMappedPage(Microsoft.SharePoint.Administration.SPWebApplication+SPCustomPage key), string GetMappedPage(string page) Name : GetMappedPage IsInstance : True
Reference
Mapping Custom Error Pages for SharePoint 2010 Site, Ram Prasad MCTS, http://www.spdeveloper.co.in/articles/pages/custom-error-pages-for-sharepoint2010-sites.aspx
Leave a Reply