Mar 23, 2011

Correlation ID in Sharepoint 2010


In this Post I am going to explain you what is Correlation ID and how it will be used to get detailed information of the error .

What is Correlation ID?

The Correlation id is a unique id like a GUID(no duplicates exists) which will be used to get detailed information of the error cause

Generally In SharePoint 2010  if we get any unexcpected error we will  see a  Correlaton id along with the message “An unexpected error has occuered”.

Here the Correlation ID is: 10be3297-1975-4d6d-953e-0931b5cde56d

By using this Correlation id we can find the error information in different ways.One of the common ways we follow is tracing the log files

Go to  the Log Directory  (generally  C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS) and Find the log file by Date and Time 


Open that log file and Search the content with this GUID . You will get information about the error.

The other way to get the error information is, by using the Power Shell  Console(Sharepoint 2010 Management Shell).

The get-splogevent  is used for this. Here is the more information about Logging and events cmdlets from msdn site.

Command :
get-splogevent | ?{$_.Correlation -eq ""} | select Area, Category, Level, EventID, Message | Format-List

Place the generated ID in the above command

get-splogevent | ?{$_.Correlation -eq "10be3297-1975-4d6d-953e-0931b5cde56d"} | select Area, Category, Level, EventID, Message | Format-List

Then you will get  more information about the error like this...(Here i got "The file xxxxx doesnt exists at.....")

And also you can download the ULS viewer tool from msdn to get the these things done easily.

Links :

Mar 17, 2011

Making Created By and Modified By as Annonymous for the SharePoint List

Hi Guys,

This is a small Post i am writing to explain you  how to show the CreatedBy and ModifiedBy fields to Annonymous(***) for the Sharepoint Lists.

This is my Tasks List. In this I created a list item. By default it shows who is created it and modified it.

Now I need to show this Created By and Modified By as Annonymous.

This is the code to  do this.

This is will be done by making ShowUser property of a list object making false as shown above.
So i get the result like this

This is a common scenario we need when we work with polls/surveys in sharePoint, when the users should be vote as anonymous.(Note : Also there are other ways to set as anonymous for the survey list in sharepoint)

Enjoy Reading..:)

Mar 4, 2011

Migrating SharePoint 2007 (Moss) site to SharePoint 2010 - Part-1

Hi Guys,

Here I am going to explain how to upgrade an existing MOSS site (SharePoint 2007) to SharePoint 2010.

Before going to do this we need to have some basic idea on the types of upgradation. Basically there are three types of approaches to upgrade in to Sharepoint 2010

1. In-place Upgrade
2. Database attach Upgrade
3. Hybrid Upgrade

Based on the environment and the other factors we will determine which approach is suitable for us. You can find more information regarding this in TechNet here).

Here I am explaining Database attach approach.These are the steps involved in this

1. Run the preupgradecheck in your MOSS environment
2. Backup the moss content database
3. Create a Site in Sharepoint 2010 server and remove its content database
4. Run Test-SPContentDatabase on 2010 server to analyze the mosscontentdb readiness to Upgradation
5. Add the moss contentdb to 2010 site
6. Visual upgrade to 2010 look and feel  (If you need)
7. Analyze If any errors related to customization ,missing files etc.

This is my MOSS site before upgradation.(Here Title: DemoSite07. Content Database :Wss_Content_5485)

The Prerequisites to Upgrade:

MOSS Server should have service pack2 Installed on it, without sp2 the preupgradecheck will not run.

Step 1:

The preupgradecheck command will give us the information about the Sharepoint 2007 Farm and the actions that need to be taken before we upgrade to sharepoint 2010. This is a nice tool provided by Microsoft, which will analyse and gives us the report in html too.

Here are the steps to use this.Open command prompt and go to the bin directory (here mine in C)

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>   stsadm –o preupgradecheck

More on Preupgradecheck rules find  here .If you get success message you can continue for the upgradation.
Step 2:

Take the Backup of your moss site's content database(WSS_Content_5485). 

Go to SQL server-->Select your contentdb(Wss_Content_5485)-->Tasks-->Backup.

  Select a location to keep your backup.

Now Copy this Backup and place in Sharepoint 2010 server.

Step 3:
Create a site in 2010 .(Here Title : Demo10, Content Db :Wss_Content_4311)

And remove the content database (Wss_Content_4311) attached to it.(through Sql or Central admin)

Central Administration-->Application Management-->Select your Web application-->Remove the content database

Click OK on above.And now restore your moss content database in to 2010.

Now go to sqlserver and restore your Moss Content Database (Wss_Content_5485) to the 2010 database Wss_Content_4311. (or you can restore to new database/any other existing , since anyhow we will attach this database tio our 2010 site through addcontentdb command in future.)

Go to sql -->Right Click on Database-->RestoreTo Database : select Wss_Content_4311.
Select from device and locate the path where your moss content database present and click Ok

Step 4

Now run the Test-SPContentDatabase PowerShell cmdlet to test your database( the above  restored moss contentdb) is ready to upgrade or not . It will tell you what are the missing files ,features, assemblies etc.

In 2010 server Go to Start Button -->All programs-->Microsoft SharePoint 2010 Products-->SharePoint 2010 Management Shell --> Run as Administrator(it is must otherwise gives u access denied error).

Run the below command in Powershell :

Test-SPContentDatabase  –Name    -WebApplication  

In Our case : Test-SpContentDatabase   -Name  Wss_Content_4311  -WebApplication  http://trainingsp2:4311.

It will give you all the information of missed files and assemblies etc..

Continuation to this is on my next post Migrate Moss site  to SharePoint 2010 site part-2

Migrating SharePoint 2007 (Moss) site to SharePoint 2010 - Part-2

Continuation to my previous post Migrate Moss site  to SharePoint 2010 site part-1

Here is the report of the Test-SPContentDatabase command

Here in my case I have created a event handler for the tasks using features in my Moss site but  I have not copied them to 2010 server so these are the errors/messages i got above

1. Missing Feature
2. MissingAssembly.

So I copied that feature and assembly from moss server to SharePoint 2010  server and then i got no errors.

Step 5:

Add the Moss content database(i.e earlier restored) to our 2010 site(Demo10).

Open command prompt and run this command

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>  stsadm -o addcontentdb -url -databasename 

Ours :stsadm –o addcontentdb  -url  http://trainingsp2:4311 –databasename Wss_Content_4311.

Above if you get 100% without any errors means the content database added to the site completely. If you get any errors check the log file at 14 hive and do the needful things (If u miss any customizations, files etc….).

With this my MOSS site is upgraded to 2010.  i.e My SharePoint 2010 site is ready with the Moss content database. 

Check it here

 Step 6 :

But the UI looks same as the Moss site . So if you want to change in to 2010 look and feel do the following settings


Select the Update the user interface (before this you can preview the new UI by selecting second option above)

Then your MOSS site appears exactly  as the SharePoint 2010 site

With this you can say  your MOSS site is upgraded to SharePoint 2010.
Step 7:

If you want to see and analyze the upgrade status go for this location  

Central Admin-->Upgrade and Migration-->Check Upgrade Status.There you will find all the trails/attempts made for upgradation with the status error information.

Here if your Status is Failed . Go to the Log File specified over there and find the causes for it. If the Status : Succeeded, you can say your Upgradation is success without any errors.

Enjoy reading...!

Mar 2, 2011

BCS in Sharepoint 2010-Part 1


Here I am going to show a small demo about how to connect to external data source and showing the external data in to sharepoint site using BCS(Business Connectivity Services).

Small Introduction about BCS:

BCS is an upgraded feature for the BDC (Business Data Catalog) of MOSS. BCS allows us to connect the external data(SQL,SAP,Webservices etc) .We can read and edit the data. This provides us the bidirectional (read or write) communication between our SharePoint site/list with the External data. (Where as in BDC only we can retrieve/read the data from external database).

You can find more information on BCS here.

Here my external data source is MS SQL server and database is BCS_DemoEmp. I have table called tblEmployee as shown below.

Now I want to integrate this data in to my sharepoint Integrate External data in to our SharePoint site, first we need to create an external content type. (Info on External Content type here.) We can do this using SharePoint designer and some other ways but using designer is most easy way. Here I am creating the external content type using Sharepoint Designer 2010.

Open the Sharepoint Designer 2010-->Open your site-->Select Site Tab in the Ribbon and Select External Content Types in left navigation

Then Select External Content Types as shown below

Select  Office Item Type : Generic List
Office Sync External List : Enabled
Click on Click here to “discover external source and define operations” link as below.

Click Add Connection --> select  Data source type : SQL Server
Give your sql connection details

Click Ok. It will connect to your database server and displays the database.Select your table(tblEmployee) and right click-->New Read Item Operation

Operation Properties Wizard will be open. Do the needed settings as below

If any warnings or errors it will show. Here no warnings and errors. Click Next

This is Input Parameters Wizard. Here you will find the Data Source Elements (Table columns) and right side section shows the properties of this element. You should map at least one data source element as Identifier (Check the “Map to Identifier”) if not you will get the error.(see by unchecking it)

Click Next

Continuation is in next part   BCS in Sharepoint 2010-Part2

BCS in Sharepoint 2010-Part 2

.....continuation part for BCS in Sharepoint 2010-Part 1

Click Finish.

Then it will be navigated back to your External Content Types Screen. There you will find an warning saying This External content type doesn’t include the Read List show below.

So select table and right click and select New Read List Operation

A wizard will be open (as in Read Item Operation)

Click Next if no errors/warnings.

In Filter Parameters step a warning saying Limit filter should be added. So click Add Filter Parameter button to add

Select Use Existing : Filter
Filter Type : Limit
Filter Field : Emp Id
And give default value 1(Emp Id)(see right side of parent window). then click Next

In this step you will see some warnings. Make sure the properties as below to avoid

Click Finish.

Then you will be navigated to previous screen with this message.

Save this External Content Type. You will find it in the Left Pane.

Now the External Content Type is Created Successfully.

Continuation is in next part BCS in Sharepoint 2010-Part 3

BCS in Sharepoint 2010-Part 3

....Continuation to BCS in Sharepoint 2010-Part2

External Content Type creation is completed .Now create a list using this content type.

Select  Create Lists & Froms option in the Ribbon

Give the name, description etc as below

Click Ok.
A list will be created with this name( EmployeeInfo_BCS) in the site.

The list creation is done. But the logged in user not having the permission to this.So it is showing error "Access denied by Business Data Connectivity".

Follow the below steps to give the permissions

Go to Central Administration-->Manage service applications under Application Management -->
then Select Business Data Connectivity Service-->Select our External Content type.And Right Click on it and

Select Set Permissions
And add the required users and give the permission as above. Now Click Ok and Back to your list (EmployeeInfo_BCS).

You will find the data. (It is similar to your database table).If you do any modifications in database it will be effected here.

Note :Here I have done Read List and Read List Item Operations only for the External content type so I can only read the data from the external database. You can create the other operations like Create, Update,Delete etc as shown below.

So that  if you create,update or delete the items in the Sharepoint  List it will be effected to your external data source.

Mar 1, 2011

Showing Related List Items in List Display Form Sharepoint 2010


This is a new feature came with sharepoint 2010 list. Here I am going to explain List Relations feature using the Lookup column and showing the associated list items of a list Item.

List 1 :  Groups

Columns : Title(Single line of text)

Add items in this List .

List 2 :   Students

Columns : StudentId (Single line of text)
                     Group (Lookup)

For column Group do the settings as below
Get Information from : Groups
In this Column :               Title
Check  Enforce Relationship Behavior checkbox
Select Restrict Delete (When an item in the target list is deleted, cascade delete will delete all related items in this list. Restrict delete will prevent the deletion of an item in the target list if it has one or more related items in this list)

Now add items to Students List.

Now we are going to show the associated List Items(students) of Group
Select Groups List à Select List In Ribbon àSelect  Modify Form Webparts and in that Select Default Display Form option(as shown below)

Then select the Insert Option in the Ribbon and Click Related List. You will see “Students”

Click Students.

Then the Students List Webpart with the heading “Related Items in Students” will be added to the page.

Now save the page. (Or Select Groups List).

Select a item in Groups list (eg : Electronics Engineering) , you will find the related students under that.

Enjoy Reading...