3
共享的用戶我有一個與更多用戶共享的實體記錄。取消激活時,我想取消共享此記錄。我想在Plugin中這樣做。但我無法理解如何讓所有用戶共享有權訪問此記錄的列表。怎麼做?MS Dynamics CRM。獲取當前記錄與
這裏是我的代碼片段:
protected void ExecutePostPersonSetStateDynamicEntity(LocalPluginContext localContext)
{
if (localContext == null)
{
throw new ArgumentNullException("localContext");
}
var context = localContext.PluginExecutionContext;
var targetEntity = (Entity)context.InputParameters["EntityMoniker"];
var state = (OptionSetValue)context.InputParameters["State"];
var columns = new ColumnSet(new[] { "statecode" });
var retrivedEntity = localContext.OrganizationService.Retrieve(targetEntity.LogicalName, targetEntity.Id, columns);
if (state.Value == 1)
{
RevokeAccessRequest revokeRequest = new RevokeAccessRequest()
{
Target = new EntityReference(personEntity.LogicalName, personEntity.Id),
Revokee = new EntityReference(neededEntity.LogicalName, needed.Id)
};
// Execute the request.
}
}
正如你所看到的,我需要一個實體「neededEntity」,我不知道如何從「targetEntity」或「retrievedEntity」得到它。