获取共享账户CRM中的特权账户实体sdk
问题描述:
我一直在想,我们如何查询以获取用户的共享账户列表。通过使用SDK我曾尝试以下方法,但不能能找出妥善的解决办法:获取共享账户CRM中的特权账户实体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工作我的脑袋解决此一整天。 任何人都可以请帮忙吗?
答
尝试使用RetrieveSharedPrincipalsAndAccessRequest
。
MSDN。
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);
}
感谢您的回答和,但如果用于获取用户ID列表的帐户,当我给系统用户作为目标就说明“的‘RetrieveSharedPrincipalsAndAccess’方法不支持类型的实体的systemuser'这个代码。其实我想要分享到特定账户的账户列表。 –
你不能共享一个帐户到一个帐户。 –
对不起,我要求获取共享给特定系统用户的帐户列表。请忽略先前的评论 –