Results 1 to 4 of 4

Thread: Sharing Records

  1. #1

    Sharing Records

    Dear Communities,
    I have 1000 of account record GUIDs, want to know these records are shared to any team or any user.
    Is there any programmatic way to approach?
    Thanks & Regards,
    Dan

  2. #2

    Sharing Records

    Hi Dans,
    since you are using crm online.
    Use below fetchxml to find all the record that shared to user, but of course you have to change a little bit.
    ps: you can create as a ssrs report.
    mscrm-chandan.blogspot.my/.../get-shared-records-for-userteam.html

  3. #3

    Sharing Records

    Hi ,
    You can also check below reference after retrieving the user or team how to share the records.
    missdynamicscrm.blogspot.in/.../crm-20112013-share-and-un-share-records-programmatically-C-sharp.html

  4. #4

    Sharing Records

    Hi,
    You can do this with "RetrieveSharedPrincipalsAndAccessRequest", please look at https://msdn.microsoft.com/en-us/lib...ssrequest.aspx for more information.
    Sample code is below;
    RetrieveSharedPrincipalsAndAccessRequest request = new RetrieveSharedPrincipalsAndAccessRequest()
    {
    Target = new EntityReference(entityLogicalName, recordId)
    };

    var serviceResponse = (RetrieveSharedPrincipalsAndAccessResponse)IOrgani zationService.Execute(request);
    You can also use XrmLibrary (2015 or 2016) and just do it with simple 2 lines below (blue lines optional process)
    CommonHelper commonHelper = new CommonHelper(_organizationService);
    var sharedPrincipalList = commonHelper.GetSharedPrincipalsAndAccess(Guid.Par se("RECORD ID"), "ENTITY LOGICAL NAME");

    if (sharedPrincipalList != null && sharedPrincipalList.Count > 0)
    {
    foreach (var item in sharedPrincipalList)
    {
    var principalInfo = item.Principal; //This returns EntityReference, so you can get PrincipalType (Team or SystemUser) and Id (for Team or SystemUser)
    }
    }



    Tags:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •