我一直想知道我们如何查询以获取为用户共享的帐户列表。通过使用SDK,我尝试了以下方法,但无法找到正确的解决方案:
QueryExpression query1 = new QueryExpression
{
EntityName = "account",
ColumnSet = new ColumnSet("name", "address1_city")
};
query1.LinkEntities.Add(new LinkEntity("account", "systemuser", "ownerid", "systemuserid", JoinOperator.Inner));
query1.LinkEntities[0].Columns.AddColumns("fullname");
query1.LinkEntities[0].EntityAlias = "share";
我是CRM sdk的新手,整天都在努力工作。 有人可以帮忙吗?
答案 0 :(得分:1)
尝试使用RetrieveSharedPrincipalsAndAccessRequest
。
var accessRequest = new RetrieveSharedPrincipalsAndAccessRequest
{
Target = leadReference
};
// The RetrieveSharedPrincipalsAndAccessResponse returns an entity reference
// that has a LogicalName of "user" when returning access information for a
// "team."
var accessResponse = (RetrieveSharedPrincipalsAndAccessResponse)_serviceProxy.Execute(accessRequest);
Console.WriteLine("The following have the specified granted access to the lead.");
foreach (var principalAccess in accessResponse.PrincipalAccesses)
{
Console.WriteLine("\t{0}:\r\n\t\t{1}", GetEntityReferenceString(principalAccess.Principal), principalAccess.AccessMask);
}