开发者

c# check if a given Sharepoint path is a root sharepoint path?

开发者 https://www.devze.com 2023-03-04 04:22 出处:网络
how can i check if a given Sharepoint path through a command line argument is 开发者_高级运维a root sharepoint path?You can check SPWeb.IsRootWeb property.In case you are running command line tool on

how can i check if a given Sharepoint path through a command line argument is 开发者_高级运维a root sharepoint path?


You can check SPWeb.IsRootWeb property.


In case you are running command line tool on the server you can use server side SharePoint OM like Petr Abdulin suggested:

new SPSite(url).OpenWeb().IsRootWeb

If you are running code on some random machine (that is not part of the farm) you will have to use Web Services (http://msdn.microsoft.com/en-us/library/dd878586(v=office.12).aspx ) or client side OM for SharePoint 2010 - http://msdn.microsoft.com/en-us/library/ee857094.aspx. Also in this case you sort of have to guess what part of the path is root web - I'd slowly increase prefixes of the Url till I can get SharePoint Web object corresponding to that path.

0

精彩评论

暂无评论...
验证码 换一张
取 消