Thursday, January 1, 2015

CreateOrganizationService method for MS CRM 2011, 2013, 2015

CreateOrganizationService method an IOrganizationService instance for the organization that the specified user is a member of.
it takes one parameter as the userId and the details of the parameter and value are as below...
1. if we pass a null value, then it will consider as the System User.
 Ex: CreateOrganizationService(null)
2. if we pass an empty GUID, then this will consider the current user's GUID
Ex: CreateOrganizationService(Guid.Empty)
Many developers, donot use this trick, they try to get the GUID and then pass here as below.
CreateOrganizationService(context.UserId)
3. for specific user, pass the guid of that user
CreateOrganizationService(new Guid("xxxxx.xxxxx.xxxx"));

regards,
Yes.Sudhanshu
 

2 comments: