0

I am a newbie in SharePoint, and now I`m trying to make a Winform application that analyse

the SharePoint site. My application works like this.

  1. Type target site url in text box and click button
  2. Analyze the Sites( web application, content database, site collection, web, list)
  3. Show the result in each DataGridView

And in Site Collection level, I have a question, is How can I get Site Collection Name(or a title)??

It is same in SPWeb.Title?

Please help me, I`m waiting your advice.....

1
SPSite oSiteCollection = new SPSite("Absolute_URL");

oSiteCollection.PortalName should give you name of site collection.

You can also get it by Rootweb object of SiteCollection and use Title property...

0

SPSite.PortalName will returns the Title of Site Collection (RootWeb of Site Collection).

SPSite oSiteCollection = new SPSite("http://Server_Name/sites/Site_Name");
string siteTitle = oSiteCollection.PortalName;

You can also get the RootWeb Title:

SPSite oSiteCollection = new SPSite("http://Server_Name/sites/Site_Name");
SPWeb rootWeb = oSiteCollection.RootWeb;
string title = rootWeb.Title;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.