简体   繁体   中英

Get the context of a team in dynamics crm

I have a list of temas in dynamics crm, I want when I create the context of crm will have only the context of one team, ie the team will not have the access to records of other teams.

I have try to change the callerID of the organizationproxy like this:

        //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);

But the team have always the access to all results

Do you have any idea how can I have only the context of the team ?

This wont work.

The OrganizationServiceProxy.CallerId expect the id of a systemuser. https://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.client.organizationserviceproxy.callerid.aspx

You could impersonate a member of that team and provided the user and team only have User/Team read access against the entity you are querying the context should be appropriately filtered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM