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.

Blogs

See More Articles

Contact us

To begin your digital transformation, get in touch.

We’re pleased to address any inquiries you might have and assist you in selecting the service that best suits your requirements.

Your benefits:
Speak To Us