how to unshare the shared record using plugin dynamics crm 2013 RRS feed

  • Question

  • i did share a record to another user using plugin.but the same record unsharing using plugin. but its not getting me.below is my code.the record is still exists in that user.

     if (context.InputParameters.Contains("Target") && (context.InputParameters["Target"]) is Entity)
                    Entity en = (Entity)context.InputParameters["Target"];
                    RevokeAccessRequest revokeaccess = new RevokeAccessRequest();
                    revokeaccess.Target = new EntityReference(en.LogicalName,en.Id);
                    Guid id = new Guid("C059255F-5930-4DD2-A2B9-61273359C123");
                    revokeaccess.Revokee = new EntityReference("systemuser",id);
                    RevokeAccessResponse revokeresponse = (RevokeAccessResponse)service.Execute(revokeaccess);

    where i'm doing wrong.

    hsk srinivas

    Friday, June 20, 2014 10:33 AM