Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Getting CRM User Date and Time Format Setting in Silverlight Microsoft CRM 2011
WhatsApp
Mahender Pal
11y
14.1
k
0
1
25
Blog
If you are working with Silverlight web resource and you need to get current crm user date time format then you can query usersettings entity and get datetime format setting for user. You can use below code for the same:
public void
RetrieveUserSettingRecord
(Guid _UserID)
{
try
{
this._d.BeginInvoke(delegate()
{
EntityReference EntityID = new EntityReference();
//the guid of the entity you want to retrieve
EntityID.Id = _UserID;
//the name of the entity type you want to retrieve
EntityID.LogicalName = "usersettings";
//define request type
OrganizationRequest request = new OrganizationRequest() { RequestName = "Retrieve" };
request["Target"] = EntityID;
ColumnSet columns = new ColumnSet();
columns.Columns = new System.Collections.ObjectModel.ObservableCollection<string>(new string[] { "dateformatstring", "timeformatstring" });
request["ColumnSet"] = columns;
IOrganizationService service = SilverlightUtility.GetSoapService();
//send the async request and specify it's callback
service.BeginExecute(request, new AsyncCallback(RetrieveCurrentUserSetting), service);
});
}
catch (Exception ex)
{
throw ex;
}
}
private void
RetrieveCurrentUserSetting
(IAsyncResult result)
{
try{
this._d.BeginInvoke(delegate()
{
OrganizationResponse Response = ((IOrganizationService)result.AsyncState).EndExecute(result);
SilverCrmSoap.CrmSdk.Entity _SystemUser = (SilverCrmSoap.CrmSdk.Entity)Response["Entity"];
if (_SystemUser.GetAttributeValue<string>("dateformatstring") != null)
{
string DateformatString = _SystemUser.GetAttributeValue<string>("dateformatstring");
}
if (_SystemUser.GetAttributeValue<string>("timeformatstring") != null)
{
string TimeFormatString = _SystemUser.GetAttributeValue<string>("timeformatstring");
}
});
}
catch (Exception ex)
{
throw ex;
}
}
Getting CRM User Date and Time Format Setting in Silverlight Microsoft CRM 2011
Up Next
5 Microsoft Dynamics CRM Online Spring ‘14 and Microsoft Dynamics CRM 2013 Service Pack 1 Features
Ebook Download
View all
Printing in C# Made Easy
Read by 22.5k people
Download Now!
Learn
View all
HIMBAP
We are expert in Microsoft Power Platform.
Membership not found