Alternative for PublishingWeb.IsPublishingWeb

December 19 2012 89 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:

0×80070002

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% [?]

89 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.
    https://www.paintersinsantaclarita.com/

  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. http://www.appliancerepairsherwood.com

  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! http://www.paramountsealcoating.com/naples-asphalt-sealcoating-company

  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

  22. boL16 says:

    “It was very informative. Thank you for sharing.
    Accountant

  23. Mori says:

    I recalled that my colleague Tomi Tavela had tackled the issue of identifying a publishing web in an anonymous scenario in a blog post titled “Anonymous Access and Publishing Web Pages List”

  24. boL16 says:

    Thanks for making this content so informative!
    Plastic Surgery Fresno

  25. boL16 says:

    Nice site and blog
    Tree Services

  26. Kath says:

    Your suggested alternative brings hope to our drywall consultant to publish on his website to boost traffic to his business. Thanks!

  27. Jasmine says:

    Thanks for sharing this awesome content. Charlotte Concrete concrete contractor

  28. Ariel says:

    Glad to check this informative site. Great work! Dalton Digital Marketing Agency

  29. Liam says:

    Would love to check this site more often now. Nice work! commercial painters

  30. builder16 says:

    Nice site and blog
    Concrete Edmonton

  31. Lulu says:

    This is a great alternative for our fence contractor to try on. Thanks!

  32. If you’re exploring alternatives for PublishingWeb.IsPublishingWeb, you might want to check out some robust solutions. One option worth considering is leveraging APIs provided by platforms like leadsgenie. Their tools offer seamless integration and can streamline your publishing workflows effectively, providing a smoother experience for your users.

  33. George Mark says:

    Such an interesting article here.I was searching for something like that for quite a long time and at last I have found it here. Clint Eastwood Vest

  34. Jenny says:

    During the winter, ice build-up, paint cracking, bug nests and infestation, and strong rainstorms and debris accumulation can all cause damage to gutters, view here..

  35. Mikoy says:

    Awesome! Thanks for figuring out the problem! https://www.charlottedrywallpros finally can move on with their project!

  36. Joseph says:

    I like the content you always share here, it is very informative. Southaven Masonry Southaven MS

  37. Zianne says:

    Thanks for always sharing here an informative content. Astro turf

Leave a Reply