Friday, May 27, 2011

70-668

Studying for the 70-668 exam. This exam looks pretty cool. I started working on MeasureUp's test for this exam and I was scoring in 90% at my first attempts. I don't know if the questions are easy or I have learnt a lot while going through other 3 SharePoint 2010 certification exams. I guess time will tell....

Power Shell to get Content Database Size

Get-SPDatabase | Sort-Object disksizerequired -desc | Format-Table Name, @{Label ="Size(MB)"; Expression = {$_.disksizerequired/1024/1024}}

Thursday, May 26, 2011

How to create host-named site Collection

Ref: Msdn

I just had to put this up here as I was asked this in one of my interview questions a while back. Pretty cool stuff.

Create a host-named site collection
You must use Windows PowerShell to create a host-named site collection. You cannot use the SharePoint Server 2010 Central Administration Web application to create a host-named site collection, but you can use Central Administration to manage the site collection after you have created it.

You can create a host-named site collection by using the Windows PowerShell New-SPSite cmdlet with the -HostHeaderWebApplication parameter, as shown in the following example:

1.To create a host-named site collection using Windows PowerShell, verify that you meet the following minimum requirements: See Add-SPShellAdmin.


2.On the Start menu, click All Programs.


3.Click Microsoft SharePoint 2010 Products.


4.Click SharePoint 2010 Management Shell.


5.From the Windows PowerShell command prompt (that is, PS C:\>), type the following:


CopyNew-SPSite http://host.header.site.url -OwnerAlias DOMAIN\username -
HostHeaderWebApplication http://servername
This creates a host-named site collection with the URL http://host.header.site.url in the SharePoint Server 2010 Web application with the URL http://servername.

Programmatically create a host-named site collection
In addition to using the Windows PowerShell to create host-named sites, you can use the SharePoint Server 2010 object model. The following code sample creates the host-named site collection with the URL http://host.header.site.url in the SharePoint Server 2010 Web application with the URL http://servername:

CopySPWebApplication webApp = SPWebApplication.Lookup(new
Uri("http://www.contoso.com"));
SPSiteCollection sites = webApp.Sites;
SPSite Site = null;
Site = sites.Add("http://hoster.contoso.com", "Site_Title",
"Site_Description", 1033, "STS#0", "contoso\owner",
"Owner_Display_Name", "Owner_Email", "contoso\secondaryowner,
"Secondary_Owner_Display_Name", "Secondary_Owner_Email", true);
SharePoint Server 2010 ships with a set of Web services for various user and administrative tasks. One of these administrative tasks is creating a new site collection. The CreateSite Web service method does not support the creation of host-named site collections. A workaround for this issue is to write a Web service that wraps the API sample code.

Tuesday, May 17, 2011

PRO: 70-576 SharePoint 2010

This afternoon, I went ahead and took this certification exam offered by Microsoft. I was pleased that this exam had a couple of question on Claims and on Windows Authentication method. I think there were 10% question on security i.e. 5/50.

The questions on claims were straight forward.

Monday, May 2, 2011

SharePoint 2010 Application Development Certification

This morning I took this exam hoping that there would be atleast a few questions on claims based authentication. Unfortunately, there were no question on this topic.

I faintly remember that in SharePoint 2010 configuration exam they do briefly cover claims based authentication in respect of extending a web application/authentication providers.

The exam that I passed was 70-573. It was a pretty interesting exam as it covered a very large aspect of SharePoint Development. The questions were mainly on these topics:
- Site and Web
- BCS
- REST (1-2)
- Logging (2-3)
- Ribbon (6-7)
- Security i.e.RunWithElevatedPrivilidges (2)
- QuickLaunch (2)
- LINQ (1)
- Query (2-3)

Sunday, May 1, 2011

Step 1: Claims Based Authentication (Software Required & Hardware)

In my setup, I had the following softwares in order to get the claims based authentication to work. You can install all the softwares on the same VM/HyperV it would not really matter. Typically most people have the list of the software below, but not have Microsoft Identity Framework. This is a free software from Microsoft that is required in order to set up STS.

- Microsoft Identity Framework 3.5 (Note: Not 4.0)
- SharePoint 2010
- Visual Studio 2010

Hardware
In my setup at the client, here is how my VM machine evolved over a period of 6 weeks:
- 1 VM - 2 GB Ram and 1 Processor (week 1) with SQL Express
- 1 VM - 4 GB Ram and 1 Processor (week 2) with SQL Express
- 2 VM - 4 GB Ram and 1 Processor and 2 GB Ram and 1 Processor (Full SQL)
- 2 VM - 4 GB Ram and 2 Processor and 2 GB Ram and 1 Processor (Full SQL)
- 2 VM - 8 GB Ram and 2 Processor and 4 GB Ram and 1 Processor (Full SQL)
- 2 VM - 8 GB Ram and 2 Processor and 8 GB Ram and 2 Processor (Full SQL)

SharePoint worked even in my week 1, but it was very slow. If you are going to be debugging the code, then it is better to start with 8GB Ram and 2 processor. If you have anything less then it takes approximately 60-70 seconds to cause the processor to break at your break point and another 20 seconds to just stop it. In the last week, we added more RAM and Processor to other VM because I added another developer. We used the same SQL Server box for the new developer too.

Tip: Creating WebApplications using Classic/Claims Mode

When you are creating a web application to use claims based authentication, ensure that the web application uses Claims based authentication. It is not possible to create a web application using classic mode and then extending it to use claims authentication mode.

Tip: Webapplication set up for Claims Based Authentication

It is better to set up a default WebApplication that connects to your AD and then extend the Web Application for Claims based authentication. One of the key advantages of this is that what if your Secured Token Services breaks down due to any reason and your manager needs some documents ASAP. A site collection admin can go into SharePoint site using their AD credentials to get you appropriate documents.

Therefore, you should have 1 Web Application and 1 extension.

Step 0: Claims Based Authentication

On the internet, you can find half a dozen walkthroughs on claims based authentication, but they all don't work accordingly. Some of them have some issue when you deploy the code.

In the next several blog posts, I will step through the process of registering a STS and Claims Provider and then setting up a Web App in SharePoint that is integrated with your STS.