Friday, 27 May 2011

Regional Settings

User can specify the regional settings from his My settings section. If he didnt specify system will take the current web regional settings.
Object Model:
SPRegionalSettings regionalSettings;
SPUser user = SPContext.Current.Web.CurrentUser;
regionalSettings = user.RegionalSettings;
if (regionalSettings != null)
{
lblTimeZone.Text = regionalSettings.TimeZone.Description;
}
else{
regionalSettings=SPContext.Current.Web.RegionalSettings;
lblTimeZone.Text = regionalSettings.TimeZone.Description;
}

No comments:

Post a Comment