Showing posts with label SharePoint 2013. Show all posts
Showing posts with label SharePoint 2013. Show all posts

Thursday, April 4, 2013

SharePoint 2013 Getting Started

SharePoint 2013 is the latest incarnation of the popular collaboration software from Microsoft. The user interface is a bit intimidating in comparison to the previous version.

Lets start creating a Site Collection using the SharePoint Central Administration.


Here I am creating a Team Site, which is the most popular SharePoint site.

The site template section has been trimmed a lot. There are no meeting sites.




The site Setting option is now found in the top right hand side of the page.
There you see the familiar options like Edit Pages. 


In SharePoint 2013 Lists and Libraries has been renamed too Apps.  



Even the popular Calendar in know as an app.

Friday, January 25, 2013

SPWeb Class with SharePoint 2013

SPWeb Class represents a web site.

The AllWebs Property of the SPSite Class will return all web sites within the site collection.

SPSite sSiteCollection = new SPSite("http://shalvin");
foreach(SPWeb sw in sSiteCollection.AllWebs)
 {
  listBox1.Items.Add(sw.Url);
  listBox1.Items.Add("Root web ? " + sw.IsRootWeb);
  listBox1.Items.Add(sw.Site);
  listBox1.Items.Add("  ");
}





The Webs property of SPWeb Calss will Return all the immediate child web sites beneath a web site.

SPcontext ctx = SPContext.Current;
SPSite site = ctx.Site;

SPWeb sw = sw.RootWeb; 
listBox1.Items.Add(web.Title);

foreach(SPWeb child in sw.Webs)
{
 listBox1.Items.Add(child.Title);
}

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(sSiteCollection.ContentDatabase);
listBox1.Items.Add("Conn String: " + sSiteCollection.ContentDatabase.DatabaseConnectionString);
listBox1.Items.Add("Web App: " + sSiteCollection.WebApplication.Name);
listBox1.Items.Add(sSiteCollection.Url);