Monthly Archive April 2012

AvatarByRashid Aziz

Create reusable content in InfoPath 2010

 I had a requirement in past where I need to create an InfoPath form which will be reusable for other custom solutions.

I have decided to create a re-useable template in InfoPath 2010. I think it’s worth showing the steps.

I have created employee info form which was going to be used again several times. So, I have created the form by drag and drop contents to the pane and the end result are look like this.

Once the form is ready follow these steps


Now go to file and click “Save as” link. Give new template a name and save it on local disk.

Now from the controls section of the ribbon, click “Expand all controls” and then click “Add or Remove Custom Controls”.

A new window will appear, now click on “Add” and follow the wizard by selecting template part and browse to the location where you saved the template earlier. Now your custom control is successfully added.

Create now form using custom control

Close the InfoPath 2010 tool and re open, create new solution and select blank form template. From the control menu select employee info control (control created in the first section) and the form will appear instantly. Now you can do the changes if want and save it.

It is very important that you create re-useable contents to save development time and efforts. J

AvatarByRashid Aziz

SharePoint 2010 time zones setting programmatically

The SharePoint 2010 server is always set to a specific time zone. Users from all over the world can change the time zone by using “My regional settings”. I wanted to achieve this programmatically as a batch operation.

To do this, I have used the following code.

SPRegionalsettings spRegnal= new SPRegionalSettings(web, true);
spRegnal.TimeZone.ID = 2 ;     // Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London
User.RegionalSettings= spRegnal ;

The SPRegionalSettings takes two parameters, the SPWeb and a Boolean. Set the time zone ID and finally get the SPUser object and assign the regional settings to that user.


AvatarByRashid Aziz

Change authentication mode in SharePoint 2010

 In the following article I will explain how to change SharePoint 2010 authentication mode. In the following example I will change authentication provider of SharePoint 2010 web application from windows authentication to claim base authentication.

To do this you need to user SharePoint 2010 management shell

Go to start menu > All programmers > SharePoint 2010 products > SharePoint 2010 management shell

Type and execute the following command

$WebAppName = “”

$account = “SPdomain\ebloginAdmin”

$wa = get-SPWebApplication $WebAppName

Set-SPwebApplication $wa –AuthenticationProvider (New-SPAuthenticationProvider) –Zone Default

A confirmation message will appear, type “Y” and press enter

Now check the authentication provider from central admin. It should show “claims based authentication”.

AvatarByRashid Aziz

Testing custom solution options for SharePoint Online (office 365)

Deploying and testing solution to SharePoint online is different from SharePoint on premises environment. For SharePoint online we can only create sandbox solutions which are site collection scoped.

There are two options for SharePoint online testing environment

1. Create new site collection

Our goal here is to provide separate environment for testing solutions. SharePoint sandboxed solutions are site collection scoped, so we can create new site collection for testing custom solution before deploying it to production site collection.

This option will not work if your code required making changes on tenant level.  E.g. if you are making use of BCS, this might be not a good option.

2. New Office 365 account (tenant)

If you want to make sure that there should be a separate environment for testing in cloud, then consider this option. You can buy a test environment license for few users, or a 30 days trial version can be used for testing purpose.