Alternative for PublishingWeb.IsPublishingWeb
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.
{
if (web == null || !web.Exists) return false;
return web.Lists.TryGetList(SPUtility.GetLocalizedString
("$Resources:List_Pages_UrlName", "cmscore", web.Language))
!= null;
}
Popularity: 1% [?]
It seems that Tomi’s approach saved the day, I hope you bought some cake or biscuits for Tomi as a thank you
Hi Wendy, glad we could help. Every day is a cake and bisquit day for Tomi
Publishing features can be deactivated at some point.
But deactivation would not delete Pages library.
Great looking internet site. Presume you did a great deal of your very own coding.|
I benefit from browsing your site. Thank you!
Hello, very good internet site you possess in here
Hi, very good webpage you possess at this time there
Thanks for the purpose of delivering this sort of awesome content
Just simply wanted to point out Now i’m glad I happened on the webpage!.
What if pages library deleted.?
Hello, I just checked out your blog and I loved it.
One of the greatest writes yet!
Awesome! These codes are the ones I have been looking for!
This is amazing! Thanks so much to this article!
Hi Wendy, you did a great job! continue what are you doing. Thanks
oh! for me this is a good alternative in publishing a web. Keep it up
Awesome! This is great.
playing with tuning of #PublishingWeb in #SharePoint2010. amazing what you can do with few lines of code!
I updated my page layouts that I deployed as a feature, but found that I could not overwrite the Layout File. The solution was to add a new page layout and then you would have to associate the new layout with every page on your site that used it.
It is a great alternative way.
Thanks for sharing this article!
Impressive method in resolving whether an SPWeb object a publishing web or not. Thanks for sharing this post.
Excellent alternative! Thanks for this article. https://arlingtonbookkeeping.com
THis is great! Thanks to this alternative for web publishing.
Amazing web publishing alternative! Thanks for sharing this site.
Thanks for this web publishing update! roofingspringfieldva.com
Nice article! Thanks for sharing this and to Tomi. Keep up the great work!
Great web publishing alternative! Thanks for this article.
Great site to visit.
Awesome post you’ve shared. Thanks.
Yes it will do sometime, Publishing features can be deactivated at some point.
But deactivation would not delete Pages library.
Applause everybody, Just simply wanted to point out Now i’m glad I happened on the webpage!
https://www.roofingrockfordil.com
Great looking internet site. Presume you did a great deal of your very own coding
https://www.floorpros.com.au/newcastle.html
Another wonderful knowledge I gained because of this post. Thank you so much. This will for sure going to help a lot. https://www.affordablelectricians.com.au/electrician-mooloolaba.html
Web publishing is the best so far when doing html, as well as css. User friendly too!
So this is it?
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;
}https://www.progressivecorporate.com.au
So this is it?
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;
}https://www.progressivecorporate.com.au
0×80070002
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetWebUrl(Guid gWebId, String bstrSiteUrl)…..https://www.affordablelectricians.com.au/croydon.html
This seems legit, according to PublishingWeb.IsPublishingWeb to https://www.floorpros.com.au/
//Publishing Web Client Object for SharePoint 2010 (CSOM)
public class PublishingWeb
{
public PublishingWeb(Web web)
{
this._web = web;
}
public static bool ReturnIsPublishingWebProperty(Web web)
{
EnsureWeb(web);
return GetProperty(web, “__PublishingFeatureActivated”, false);
}
https://www.floorpros.com.au/newcastle.html
Perhaps, we need to emphasize 0×80070002
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetWebUrl(Guid gWebId, String bstrSiteUrl)…..https://www.officeremovalistsydneynsw.com.au/
Indeed true, Publishing features can be deactivated at some point.
But deactivation would not delete Pages library.https://www.bathroomrenovationswesternsydney.com.au/
What happens if the library pages will be deleted?
This post quiet caught my attention since it talks about publishing a web. This may seem going to help me enhancing my knowledge about web publication.
cool information
publishing the web is the great kind of job that can make lots of people enhance their knowledge in internet site.
https://link169273640.wordpress.com/
This is awesome. Glad I have read your blog. Thank you.
They are such a great performer. Amazing.
They are awesome. Thanks for this brilliant information.
Great information, thanks for the share.