Alternative for PublishingWeb.IsPublishingWeb

December 19 2012 72 comments

Just today I wondered why something was not working with a specific custom code and was able to track the problem down by debugging to using PublishingWeb.IsPublishingWeb -method to a web in another site collection with read-permissions. The error message was somewhat puzzling, something like:


at Microsoft.SharePoint.Library.SPRequestInternalClass.GetWebUrl(Guid gWebId, String bstrSiteUrl)…..

Then I remembered that my colleaque Tomi Tavela had resolved figuring out whether the SPWeb object is a publishing web or not in an anonymous scenario in this post Anonymous Access and Publishing Web Pages List.

So what I did following Tomi’s approach was to implement an alternative for the awkwardly behaving PublishingWeb.IsPublishingWeb -method by creating a method which checks if the site (SPWeb) has got a Pages-library.

public static bool IsPublishingWeb(SPWeb web)
    if (web == null || !web.Exists) return false;
    return web.Lists.TryGetList(SPUtility.GetLocalizedString
           ("$Resources:List_Pages_UrlName", "cmscore", web.Language))
           != null;

Popularity: 1% [?]

72 comments to “Alternative for PublishingWeb.IsPublishingWeb”

  1. edinburgh shemales is great web place for free chat contacts in UK

  2. V8web says:

    Really good post!! Many thanks!

  3. Great article! Are you planning on publishing an article related to car detailing in Lakeland, FL?

  4. Great Article. Really very useful.

  5. Find fine ladies from EU for chat and other kind of casual contacts at sex in schleswig holstein

  6. Atlas says:

    Great work. Thanks for the lesson.

  7. Shemale Montpellier is the best for your own casual chat pleasure

  8. Sex Sachsen says:

    Sex Sachsen hat für Sie gesorgt. Es ist im Grunde die erste Anlaufstelle für alle, die in die Welt der Partnersuche einsteigen. Wenn Sie beim Online-Dating auf Nummer sicher gehen wollen, müssen Sie dort swipen, wo alle swipen.

  9. Sex BW says:

    Sex BW ist eine erotische Website, wo Sie mit all Ihren aufregenden, frechen und geilen Fantasien gehen können. Ob Sie neue Sexkontakte für sehr perverse Gedanken oder jemanden für eine “normale” geile Nacht suchen, Sie werden hier alles finden und alles dazwischen. Hier finden die heißesten Gespräche statt!

  10. Transen says:

    Transen ist eine relativ neue Dating-App für Menschen mit Trans-Erfahrung und solche, die sich mit ihnen treffen möchten. Die Profile sind einfach und leicht zu bedienen

  11. Kelly Grant says:

    I believe this post is very useful. Thank you for sharing this with us! Handyman Pros of Lethbridge

  12. Angel17 says:

    I find this so informative. Thanks for sharing this.

  13. builder16 says:

    Hey! this is a very interesting post, I liked it…
    Tree Services Richmond VA

  14. builder16 says:

    Nice post! Thanks for taking the time in sharing this great article in here.

    Plastic Surgery Mesa

  15. Tom says:

    Nice approach to the problem. Our licensed contractor would probably follow your tips. Thanks!

  16. boL16 says:

    “Thank you very much for this wonderful topic!
    Landscaping Red Deer AB

  17. builder16 says:

    “very informative article!!! thank you so much!

    Concrete In Red Deer

  18. Amber Brion says:

    Thank you for sharing your experience and the alternative approach you implemented. It’s always inspiring to see how developers overcome challenges and find creative solutions. Keep up the great work!

  19. Jane says:

    That’s great! It’s always satisfying to track down a problem and find a solution. Search Engine Optimization

  20. Jamie says:

    Do you think publishing a web can help me with my home remodeling business? Let me know. More power!

  21. boL16 says:

    “Thank you for this amazing blog!
    Plastic Surgery

Leave a Reply