Retrieving Mapped SharePoint Custom Pages from PowerShell
Body: 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
$webapp.GetMappedPage([Microsoft.SharePoint.Administration.SPWebApplication+SPCustomPage]::Signout)
The Clue
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
Category: Administration; SharePoint 2010; powershell
Published: 5/20/2013 4:37 PM
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
Category: Administration; SharePoint 2010; powershell
Published: 5/20/2013 4:37 PM




Published on May 20, 2013 14:37
No comments have been added yet.
Tom Resing's Collaboration Blog
I publish about 2 articles a month to this site and focus on web collaboration topics. If you have an idea for a post topic, please feel free to contact me. You can read more about me. Or Subscribe to
I publish about 2 articles a month to this site and focus on web collaboration topics. If you have an idea for a post topic, please feel free to contact me. You can read more about me. Or Subscribe to new posts by email.
...more
- Thomas Resing's profile
- 19 followers
