Have you ever tried to retrieve all the records (all accounts/opportunities) shared to a particular user?
I found one of a user asking the same in CRM development forum. Refer here for the thread.
As you are all aware CrmService exposes RetrieveSharedPrincipalsAndAccess message for retrieving the access rights.
Limitation: The above approach can be only used for a specified entity instance (for a particular record defined by its GUID).
What if the user wants to obtain the result of all the record (accounts/opportunity/...) shared to a particular user?
There is not any special message exposed by CrmService as like RetrieveSharedPrincipalsAndAccess to get it done. Hence we are on own now.
The immediate workaround that striked me is CrmService.Fetch method.
Sharing related infromations are stored in PrincipalObjectAcces.
Even though principalObjectAcces is not exposed outside, fetchXML wont restrict in using it. Taking this as an advantage you can obtain our required result using fetch method
Come lets try to Obtain all the Opportunity shared for a particular user.
1. Opportunity Object Type Code(3)
2.SystemUser (to which the record is shared)
Happy Coding !!!