Thursday, December 2, 2010

Creating Web Applications, Site Collections and Sites

Problem

In a recent tip, I discussed installing the Windows SharePoint service and SharePoint Foundation 2010. Once you have completed the installation, you need to understand the steps to create a web application, site collections and sites. In this tip, we cover the steps required to complete your SharePoint installation.

Solution

In this tip I am going to use SharePoint 2010 Central Administration to create a web application, site collections and sites. The same can be done programmatically by using PowerShell using the SharePoint libraries or object model / SharePoint APIs. In future articles, I will talk about how setup can be done programmatically.

Web Application

In the SharePoint hierarchy, a web application is the top tier.  It is nothing but an IIS (Internet Information Services) website which is specifically configured to run as a SharePoint site and contains at least one or more site collections. While creating a web application you can either associate it with an existing application pool or you can create a new application to be associated with it. While creating your SharePoint web application you also need to specify a content database and details like authentication method used to connect to the content database.  It is possible to have multiple content databases for different site collections for the web application. Using multiple databases makes it easier for content database management, backup, restore, etc...

Site Collections

As I mentioned above, a web application needs to have one or more site collections. A site collection is a logical container for grouping sites and allows hierarchical arrangement of sites within it. A site collection has exactly one default top level site and may have many child sites. By default all sites of a site collection share navigation, security/permissions, templates and content types so you should plan to include all sites in single site collection if they all need to share these things.  If needed, you can specifically change settings for a particular site if required.

Sites

A site collection has at least one parent site which is created by default when you create a site collection and may have many other sites within its hierarchy. A site allows us to organize and store all content in SharePoint, the content can be Lists, Libraries (Document Library, Picture Library, Report Library, Form Library etc...) Web pages, Web parts, Sites and Workspaces. Further a site can have child sites in its hierarchy. 


Enough on concepts, let's go through some examples:

Go to START -> All Programs -> Microsoft SharePoint 2010 Products and click on SharePoint 2010 Central Administration, this will open the Central Administration site UI as shown below. Click on Manage web applications under Application Management in Central Administration page or under Web Applications in the Application Management page. 





On the web applications page, in the right pane you will notice all the web applications created so far. On top you will see an Office style ribbon which is a new feature of SharePoint 2010. Because we intend to create a new web application, simply click on the New option in left most side of the ribbon.

This will open up a Create New Web Application page, you need to specify different settings/parameters for your new web application to be created. Some of these settings/parameters are described below:

Settings
Description
Authentication
This setting allows you to define the authentication method for SharePoint users. In classical mode, users are authenticated to access the web application using Windows authentication. The claim based authentication is new with SharePoint 2010 and allows users to be authenticated by Windows authentication or form based authentication (FBA) or a trusted identity provider (SAML) so that users from heterogeneous systems can access the web application.
IIS Web Site
With this setting you specify whether you want to create a new IIS website or use an existing IIS website for your web application. Next you specify the port number for your new IIS website or this will be the same as the existing IIS website if you are re-using it. Host Header is an optional setting and is used in case you want to share the same port number across multiple IIS websites. If you specify anything here you also need to configure DNS to route requests to the appropriate server. Path is the physical location where files for the web application will be copied.
Security Configuration
With this setting you specify the authentication provider to be used by this web application, it could be either Negotiate (Kerberos) or NTLM. Select Allow Anonymous to Yes if you want your web application to be enabled for anonymous access, it uses the computer-specific anonymous access account i.e. IIS_IUSRS. Next you can enable SSL for your web application, but you also need to install and configure an SSL certificate in IIS.
Application Pool
This setting associates an application pool with your web application; you can either choose to use an existing application pool or create a new one for your web application. If you are creating a new application pool for your web application you also need to specify the security credential either predefined or configurable.
Database Name and Authentication
This setting allows you to define the database server where the content database for your web application will be created (or will be reused from); next you need to specify the content database name and authentication mechanism to connect to the database server. Windows authentication is recommended as is SQL authentication, note that passwords are sent unencrypted to SQL Server by default.
Failover Server
If you have configured database mirroring for the content database then you can specify the name of the failover server here.
Service Application Connections
You can use either Default or Custom, if you choose Default the web application will be connected to the default set of service applications or you can use Custom to individually select the service applications on which this web application will be connected to.
Customer Experience Improvement Program
If you select Yes, SharePoint sends program errors and information to Microsoft for improving the product.
Once you have specified all of the required/optional parameters on the Create New Web Application page, simply click on the OK button and wait for the web application to be created. Once the web application is created you will see a screen like below. Click on the Create Site Collection link to create a site collection as the web application is not usable unless you create at least one site collection.
On the Create Site Collection page, first you need to specify the Title and Description for your new site collection.
Next you need to specify the URL for your site collection in the Web Site Address section.
Then you need to select one of the several available custom created templates which will be used as a blue-print to create your site collection.
Next you need to specify the Primary Site Collection Administrator, specifying the Secondary Site Collection Administrator is an optional setting, but recommended as it allows secondary administrator to take charge of administration if the primary administrator is not available.
Next if required, you can use the Quota template to restrict growth of your site collection to a certain limit.
Click on the OK button and you are done with the creation of the SharePoint web application. Click on the link and you will see your web application like this.
We normally create a site for each division/department/project.  To create more sites, click on Site Action on the top left corner and you will see several options like this (this is another change from last SharePoint version where it used to be on top right side):
Click on New Site and specify different parameters (Title and URL) for your new site as shown below.
You can create as many sites as you want, for example I have created a couple of different sites for each department of the organization as you can see below.

Notes

  • You need to have appropriate permissions in order to create a web application, site collections and sites.
  • When you create a web application, you also need to create a site collection to make your web application usable. When you create a site collection a parent/top level site is created by default which you can use for common information, news, announcements etc.
  • If you want your web application to be available to extranet users you can extend your existing web application to have separate IIS websites that expose the same content to the extranet users.

creating libraries in SharePoint 2010

Problem

Let's understand how we can organize content using the different types of libraries and to understand what a library is all about?

Solution

A library is a container for creating, organizing and managing different types of documents. It allows us to store files and meta information about the files, so that it can be used among different team members. You can create, store and manage almost every type of file in different kinds of libraries (i.e. Word documents, spreadsheets, presentations, forms etc).

By default a Shared Library is created when you create a site and additionally you can create as many types of libraries as you want. There are specialized types of libraries available in SharePoint Server 2010 to store specific types of content such as:

Type of LibraryDescription
Asset LibraryAsset Library allows you to create a rich media library and lets you create, browse, share, organize and mange images, audio and video files.
Data Connection LibraryHere you can create, browse, share, organize and manage files that contain information about connecting to external data connections.
Document LibraryHere you can create, browse, share, organize and manage documents or other files. It also allows creating folders, versioning of documents and check-in/check-out of files.
Form LibraryHere you store and manage Microsoft Office InfoPath forms (or XML files for use with Microsoft Office InfoPath) for instance business forms like a status report, purchase orders, etc...
Picture LibraryHere you can upload and share pictures with others and it includes a built-in image viewer.
Report LibraryHere you can create web pages and reports to track business metrics, goals, KPIs (Key Performance Indicators) and business intelligence information.
Slide LibraryIt allows you to create a library for storing and sharing Microsoft PowerPoint slides.
Wiki Page LibraryIt allows you to create and store customizable pages of content that are linked together and can be edited by several people.

Creating a Document Library...

In your SharePoint Web application, select the site under which you want to create the Document Library and expand the Site Actions menu on the top left side as shown below. You will notice there is a specialized option to create a Document Library from here or you can click on More Options to select the type of Library you want to create as shown below.
On the left pane select "Library" to limit your choices to just Library objects. Select the appropriate type of library you want to create from the middle pane and on the right side specify the name of the library and finally click on the "Create" button. If you want to specify different properties or behaviors of your library, you can click on the "More Options" button which will open a screen as shown below.
Here along with the name of your library you can also specify a brief description. In the Navigation section you can select whether you want your library to be listed on the Quick Launch on left side of the site. Next you can enable versioning for all the documents in the document library, or in other words, each time a file in the library will be edited a major version will be created for it. Document Template allows you to select what default type of file will be created in the document library; for example as you can see below I have selected Microsoft Word document and on the next screen I will show how it appears in the New Document menu.
Click on the "Create" button and wait for your library to be created. Below shows the Library that was created. Notice the Library Tools menu option becomes available in the ribbon style menu which has the Document and Library menus.
Click on the "Add" document link to add documents to your library. You can either upload one document at a time or have multiple documents uploaded in a batch.
As I said before, the Library Tools menu appears in the ribbon menu when you select a library. It has Documents and Library options. The Documents menu allows you to create a new document, upload documents, create folders in the library, check-out, check-in files, etc. The Library menu option has several options to manage your library, for example you can edit your library in SharePoint Designer and change different library settings.


Deleting a Document Library...

Select the library and then the Library Tools menu will appear in the context sensitive ribbon style menu. Select the Library sub-menu and on the right side you will see the Library Settings option as shown below, click on this option.
The Library setting page allows you to change different settings for your library. For example you can change the versioning option, change permissions, delete the library, etc... Click on "Delete this document library" to delete it and you will be prompted for confirmation, then click OK. If you delete your library, then your library will move into the Recycle Bin.
You can restore your library from the Recycle Bin or delete it permanently from there. If your library does not appear under Libraries after restoration you can go to the library setting (by clicking on All Site Content) and change the option to appear in Quick Launch under Title, description and navigation link.
Note: You need to have appropriate permissions on the site to create and manage libraries.

SharePoint Document Check-In and Check-Out

Problem

SharePoint is a collaborative platform. A central feature is the ability to share documents with other users. But what if multiple users try to edit the same document at the same time? This can lead to versioning conflicts and confusion about changes. How can this be prevented?

Solution

SharePoint provides a feature called document Check-In and Check-Out. The purpose is to exclusively lock a document for modification by a user. Once the changes are complete the user can check-in the updated document to release the lock and make the changes visible to other users.
When you check-out a document, you get an exclusive lock to edit that document and can be sure no other users can make any changes to the same document. Though other users can read the document, they will not be able to edit it or even will see your changes unless you check-in the document. While a document is checked-out, you can edit it, close it, reopen it, even work offline with it. Once your required changes are done you can check-in the document to release the exclusive lock which you had for document editing. Your changes are then available to other users. While checking-in the document you can also specify a comment about the changes to help others understand what has changed.
If the version control feature is enabled, this comment will become part of document version history, so if needed you can revert back to an older version by looking at the comment. (I will be talking in detail about version control in a future tip.)
There might be a time after checking out a document where, where you want to discard your changes, even after saving them. You can then discard your changes by un-doing a check-out.
Example
Click on the dropdown (arrow) icon on the document as shown below, then click on the Check-Out option to check out the document (this gives you an exclusive write lock on the document).
In SharePoint 2010, you can also check out a document by selecting a document in the library and then clicking on Check-out option in the Documents ribbon (2nd image below).
When you make changes to a checked-out document, the document is stored by default on your hard disk in a drafts folder that is in your "My Documents" folder (when using WSS 3.0) or with SharePoint 2010, the default location is the web server. The location of the local cached copy is configurable. (That, however, is outside the scope of this tip.)

Once a document is checked-out it will be indicated with a tiny down arrow icon as shown below. If you hover the mouse pointer on it, then it will show who has checked out that document.
Once you have checked out a document, you can open and edit it. The moment you save and close the document, you will be prompted with the below alert. If you select "No" the changes you make to the document will be available locally only to you. No other users will be able to see those changes unless you check-in the document (by clicking "Yes").
While checking-in your document you can specify any comments about the changes you have made to the document. If Version Control is enabled for the document library, this comment will become part of version history and will be quite helpful.
Looking at the different comments in the version history can help you choose the right version when reverting back to older version. While checking-in your document, you also get an option to check in the changes, while at the same time keeping the document checked out. This enables others to see your changes, but you still have the document locked so others cannot make changes.
If the document is already checked out by someone else and you try to check it out, you will be prompted with this message about who has checked-out the document and what options are available to you.
For example, When I tried to check-out an already checked out document (see below), I was informed that the document is already checked out, by who and when, and then given an option to override the checked-out by that user.



You can operate many of the SharePoint Check Out features directly from MS Office applications as well. Below you can see a checked out document in MS-Word and the options to perform other actions to it.