在 Dynamics CRM 中获取团队的上下文
Get the context of a team in dynamics crm
我在 dynamics crm 中有一个 temas 列表,我希望在创建 crm 上下文时只有一个团队的上下文,即该团队将无法访问其他团队的记录。
我尝试像这样更改 organizationproxy 的来电显示:
//original context
OrganizationServiceContext contextORI = new OrganizationServiceContext(organisationProxy);
//i search th team
team team= (from k in contextORI.CreateQuery<Utilisateur>()
where k.Id == TEAM.Id
select k).FirstOrDefault();
//i change the caller of organisationProxy
this.organisationProxy.CallerId = team .Id;
//i create the new context
OrganizationServiceContext context = new OrganizationServiceContext(organisationProxy);
但团队始终有权访问所有结果
你知道我怎么可能只有团队的上下文吗?
这行不通。
OrganizationServiceProxy.CallerId 需要系统用户的 ID。
https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.client.organizationserviceproxy.callerid.aspx
您可以冒充该团队的成员,前提是该用户和团队仅对您正在查询的实体具有 User/Team 读取权限,应适当过滤上下文。
我在 dynamics crm 中有一个 temas 列表,我希望在创建 crm 上下文时只有一个团队的上下文,即该团队将无法访问其他团队的记录。
我尝试像这样更改 organizationproxy 的来电显示:
//original context
OrganizationServiceContext contextORI = new OrganizationServiceContext(organisationProxy);
//i search th team
team team= (from k in contextORI.CreateQuery<Utilisateur>()
where k.Id == TEAM.Id
select k).FirstOrDefault();
//i change the caller of organisationProxy
this.organisationProxy.CallerId = team .Id;
//i create the new context
OrganizationServiceContext context = new OrganizationServiceContext(organisationProxy);
但团队始终有权访问所有结果
你知道我怎么可能只有团队的上下文吗?
这行不通。
OrganizationServiceProxy.CallerId 需要系统用户的 ID。 https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.client.organizationserviceproxy.callerid.aspx
您可以冒充该团队的成员,前提是该用户和团队仅对您正在查询的实体具有 User/Team 读取权限,应适当过滤上下文。