Retrieve Users/Teams who has access on the record


Today, we got a requirement to retrieve list of users/Teams who has access on the record as part of business requirement.

SDK has a message to full fill this requirement. i.e RetrieveSharedPrincipalsAndAccessRequest

Here is the C# sample code for using it.

RetrieveSharedPrincipalsAndAccessRequest req = new RetrieveSharedPrincipalsAndAccessRequest();
req.Target = erfRecord;
RetrieveSharedPrincipalsAndAccessResponse resp = (RetrieveSharedPrincipalsAndAccessResponse)crmService.Execute(req);
foreach(PrincipalAccess prinAccess in resp.PrincipalAccesses)
     // prinAccess.AccessMask
     // prinAccess.Principal

AccessMask holds the access information
Principal holds the User/Team information.

Happy CRM’ing


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s