Friday, November 15, 2013

Site Collection in Sharepoint2010

What is Site Collection?

A SharePoint site collection is a hierarchical set of sites that can be managed together. Sites within a site collection have common features, such as shared permissions, galleries for templates, content types, and Web Parts, and they often share a common navigation. A site collection contains a single top-level site, and any number of subsites organized in a hierarchy.
The site collection is typically created using one of the out of the box SharePoint site templates for the root site that is provisioned with it. The following are the available templates for a site collection (out of the box).
Tip: The template you choose for your site collection impacts what the site collection contains when it is provisioned.  It’s always a good idea to select a template that closely matches the default content, components and settings you desire.

Site Collection Root Site Templates

·         Collaboration Site Templates
There are a number of site templates that come with SharePoint that are designed to support collaboration based activities with default content.
o   Team Site
Create this kind of site for teams to quickly organize, author, and share information. It provides a document library, and lists for managing announcements, calendar items, tasks, and discussions.
o   Blank Site
Create a blank site if you want nothing provisioned within the site. This is the best template to use when restoring or importing content from a previous source.
o   Document Workspace
Create this kind of site for colleagues to work together on a document. It provides a document library for storing the primary document and supporting files, a tasks list for assigning to-do items, and a links list for resources related to the document.
o   Blog
Create this kind of site for a person or team to post ideas, observations, and expertise that site visitors can comment on.
o   Group Work Site
This template provides a groupware solution that enables teams to create, organize, and share information quickly and easily. It includes Group Calendar, Circulation, Phone-Call Memo, the Document Library and the other basic lists.
o   Microsoft Project Site
Create a project site to support team collaboration on projects. This site includes Project Documents, Project Issues, Project Risks, and Project Deliverables lists which may be linked to tasks in Microsoft Project Server 2010.
o   Visio Process Repository
Create a Visio process repository site for teams to quickly view, share, and store Visio process diagrams. It provides a versioned document library for storing process diagrams, and lists for managing announcements, tasks, and review discussions.
·         Meeting Site Templates
Typically the following meeting site templates really should not be used as the root site of a site collection unless there is a strong expectation of extremely large volumes of meeting content.
o   Basic Meeting Workspace
A site to plan, organize, and capture the results of a meeting. It provides lists for managing the agenda, meeting attendees, and documents
o   Blank Meeting Workspace
Create a blank site if you want nothing provisioned within the site. This is the best template to use when restoring or importing content from a previous source.
o   Decision Meeting Workspace
A site for meetings that track status or make decisions. It provides lists for creating tasks, storing documents, and recording decisions.
o   Social Meeting Workspace
A site to plan social occasions. It provides lists for tracking attendees, providing directions, and storing pictures of the event.
o   Multipage Meeting Workspace
A site to plan, organize, and capture the results of a meeting. It provides lists for managing the agenda and meeting attendees in addition to two blank pages for you to customize based on your requirements.
·         Enterprise Site Templates
o   Document Center
A site to centrally manage documents in your enterprise.
o   Records Center
This template creates a site designed for records management. Records managers can configure the routing table to direct incoming files to specific locations. The site also lets you manage whether records can be deleted or modified after they are added to the repository.
o   PowerPoint Broadcast Site
A site used for hosting PowerPoint broadcasts. Presenters can connect to this site and create a link for remote viewers to watch a slide show in a web browser.
o   Business Intelligence Center
A site for presenting Business Intelligence Center.
o   Enterprise Search Center
A site for delivering the search experience. The welcome page includes a search box with two tabs: one for general searches, and another for searches for information about people. You can add and customize tabs to focus on other search scopes or result types.
o   My Site Host
A site used for hosting personal sites (My Sites) and the public People Profile page. This template needs to be provisioned only once per User Profile Service Application, please consult the documentation for details.
o   Basic Search Center
A site for delivering the search experience. The site includes pages for search results and advanced searches.
o   FAST Search Center
A site for delivering the FAST search experience. The welcome page includes a search box with two tabs: one for general searches, and another for searches for information about people. You can add and customize tabs to focus on other search scopes or result types.
·         Publishing Site Templates
o   Publishing Portal
A starter site hierarchy for an Internet-facing site or a large intranet portal. This site can be customized easily with distinctive branding. It includes a home page, a sample press releases subsite, a Search Center, and a login page. Typically, this site has many more readers than contributors, and it is used to publish Web pages with approval workflows.
o   Enterprise Wiki
A site for publishing knowledge that you capture and want to share across the enterprise. It provides an easy content editing experience in a single location for co-authoring content, discussions, and project management.
Note: Some of the above templates are not available in Foundation or Standard.

Benefits of  creating  a site collection in SharePoint

  1. ·         For Security Management Benefits:
Every site collection creates a security boundary between one collection of sites and another collection of sites. Each site collection has its own collection of SharePoint groups and ACL references.

  1. ·         For Privacy or Management Benefits and Different Site Collection Administrators
Each site collection has a role of “Site Collection Administrator” and a person or more assigned to that role. There are times when either for privacy/confidentiality reasons you cannot have a specific site collection administrator with the rights to see that sites content, or where you have different people that should be assigned to manage that collection of sites. The second is an extremely common scenario in large enterprise organizations where there is a need to distribute the technical ownership of site collection administration.
  • ·         For Search Separation
  • ·       For Workflow Separation
  • ·         To Impose Specific Storage Quotas

With SharePoint Site Collections you can define specific storage quotas and email warnings to notify users when they are approaching a defined threshold on their site collection storage.
  • ·         To Impose Specific Sandbox Quotas

With a SharePoint Site Collection you can define the maximum number of points sandbox solutions can use per day. Additionally you can also configure an email warning when storage exceeds a certain number of points.


Site (or Subsite)

A subsite is a single SharePoint site within a site collection. A subsite can inherit permissions and navigation structure from its parent site or these can be specified and managed independently. Creation of subsites can be delegated to users of a site collection, but creation of site collections must be performed by a service administrator.
Typically within an organization you will create additional site templates over time. These are often built based on the out of the box site templates. What follows is an outline of each of the out of the box site templates and when I think they should be used.


Web Applications, Server, Server Farm

Web Applications, Server, Server Farm

A web application is the logical component:
  • It has a Host Header (URL), e.g. http://intranet.
  • It stores data inside one or more associated content databases.


A web application can have several site collections all accessed by a host header:
Web Server
A web server is a server where a set of services are running to publish web sites to the internet or intranet. Of course a web server can publish more than one web site:















Multiple SharePoint servers are grouped to a SharePoint server farm.

Server Farm

While the front-end web server publishes information to the Internet or Intranet the database server is required to store configuration data and content.

A server farm can have multiple front-end and database servers.





SharePoint 2010 - Central Administration

SharePoint 2010 - Central Administration

The SharePoint Central Administration is a website used for:
•Application Management (Web Application, Sites, Lists, Services etc.)
•Monitoring (Job Status, Problems etc.)
•Security
•Application Settings, System Settings
•Performing Backup/Restore
•Configure Search, Services, Migration Assisting etc.
•In summary the Central Administration is an Administrator/Developer tool. It is used to manage the websites for other users.

Opening Central Administration

We can access central administration from the start menu item:


On executing the command you can see the following screen in the browser (ensure you provided the credentials properly - by default it will be system username and password)

Application Management
The Application Management page contains those tasks directly related to the management of site collections, sites, web applications, and service applications. It is subsequently a page where an administrator can spend a great deal of time during the initial configuration of SharePoint 2010.
System Settings
The System Settings page contains those tasks related to the settings of the system, e-mail and text messages, and farm management. We can manage the servers, configure outgoing email settings, configure mobile account, configure privacy options, manage farm features and manage farm solutions etc.
Monitoring
The monitoring features in SharePoint Server 2010 use specific timer jobs to perform monitoring tasks and collect monitoring data. The health and usage data might consist of performance counter data, event log data, timer service data, metrics for site collections and sites, search usage data, or various performance aspects of the Web servers. The system uses this data to create health reports, Web Analysis reports, and administrative reports. The system writes usage and health data to the logging folder and to the logging database.
Backup and Restore
This describes the backup architecture and recovery processes that are available in Microsoft SharePoint Server 2010, including farm and granular backup and recovery, and recovery from an unattached content database. Backup and recovery operations can be performed through the user interface or through Windows PowerShell cmdlets. Built-in backup and recovery tools may not meet all the needs of your organization.
Hierarchy
Server Farm: Server Farm contains multiple components like SharePoint server and database server providing multiple Web Applications spanned over multiple machines. For development machines one single machine can support all the components.
 
Web Application: Web Application contains multiple Site Collections. This could be equivalent to an ASP.NET application.
Site Collection: Site Collection contains multiple Sites.
Site: Site contains Lists, Documents etc.






Create a list in SharePoint and Read List details using C#

Prepare the custom list with the name as Products and click Create to create a list as shown in the below figure:

   After creating a list you can add items in a list by selecting Add new item option.But before inserting items add columns in a list. You can add columns in a list by selecting Create Column option. Here I am adding two columns i.e. Product ID and Product Name.
     After adding the columns add rows in a list by inserting item.


Add as much as products you want just by clicking add new item

Now open visual studio and take a console application
Then write the below code in the Program.cs file.

Don't forget to add reference to Microsoft.SharePoint.dll


using System;
using System.Text;
using Microsoft.SharePoint;

namespace ReadSharePointList
{
    class Program
    {
        static void Main(string[] args)
        {
            //SPSite object
            SPSite oSpSite = new SPSite("http://mysite/");

            //Connect to the web using SPWeb object
            SPWeb oSPWeb = oSpSite.OpenWeb();

            //List Object to get the list from a sharepoint site
            SPList oSpList = oSPWeb.Lists["Products"];

            //Item Collection Object getting all the items form the list
            SPListItemCollection oSpListCln = oSpList.Items;

            //iterate through all the items in itemcollection object
            foreach (SPListItem item in oSpListCln)
            {
                Console.Write(item["Product ID"] + "\t\t");
                Console.WriteLine(item["Product Name"] + "\n");
            }
        }
    }
}


save and Run.

Note: If there is error in compilation change the platform target to X64 in the project properties.





Create Edit Delete a sharepoint List using visual studio



This article explains how to add , edit, delete list items in sharepoint using visual studio.


Create a List named Tasks using the Tasks template.



Now take a new console application . Make sure that you have choosen .net framework 3.5.

Adding an Item

For adding a new Task Item execute the following code:

Don't forget to add reference
  Microsoft.SharePoint.dll


using (SPSite site = new SPSite("http://mysite"))  //provide your site url
{
    
using (SPWeb web = site.OpenWeb())                
    {
        
SPList list = web.Lists["Tasks"];
        
SPListItem item = list.Items.Add();
        item[
"Title"] = "New Task";
        item[
"Description"] = "Description of Task";

        item.Update();
    }
}

Now you can check the Tasks list inside SharePoint and you will see the new item there.

Editing an Item

For editing an existing Task use the following code. Here we are changing the first item Title and Description.
using (SPSite site = new SPSite("http://mysite")) //provide your site url
{
    
using (SPWeb web = site.OpenWeb())
    {
        
SPList list = web.Lists["Tasks"];
        
SPListItem item = list.Items[0];
        item[
"Title"] = "Edited Task";
        item[
"Description"] = "Description of Task (edited)";
        item.Update();
    }
}

Going back to SharePoint you can see the Edited Task
Deleting an Item

For deleting an item use the following code.

using (SPSite site = new SPSite("http://mysite"))   //provide your site url
{
    
using (SPWeb web = site.OpenWeb())
    {
        
SPList list = web.Lists["Tasks"];
        
SPListItem item = list.Items[0];
        item.Delete();
    }
}
Now you can go back to SharePoint and see that the item was deleted.



Note:  If there comes any error while compiling make the target platform as "any cpu" or x64 in the project properties.