Friday, January 25, 2013

SPSite Class with SharePoint 2013

SPSite Class Represents a collection of sites in a web application. It comprises of the top level site and all its sub sites.
SPSite Class is under Microsoft.SharePoint namespace. Microsoft.SharePoint.dll is placed in Program Files\Common Files\Microsoft Shared\Web Server Extensions\15, also  called 15 hive.

We will start with a SharePoint 2013 Visual Web Part project.

using Microsoft.SharePoint;

SPSite sSiteCollection = new SPSite("http://shalvin");

listBox1.Items.Add("Conn String: " + sSiteCollection.ContentDatabase.DatabaseConnectionString);
listBox1.Items.Add("Web App: " + sSiteCollection.WebApplication.Name);

No comments:

Post a Comment