Azure Active Directory Graph Client 2.0 - Context is not currently tracking the entity

前端 未结 3 1204
醉酒成梦
醉酒成梦 2020-12-20 04:01

I have recently installed the Azure Active Directory Graph Client Library 2.0.2 Nuget package and am unable to add Members to Groups both adding a group to a group or adding

3条回答
  •  轮回少年
    2020-12-20 04:11

    We’ve just released an update to the Graph client library, that fixes this problem. You should now be able to add members to groups. The mechanism is a little different from using AddLinks (and hopefully simpler).

    We also have a new blog describing the client library which talks about this and many other things: http://blogs.msdn.com/b/aadgraphteam/archive/2014/12/12/announcing-azure-ad-graph-api-client-library-2-0.aspx

    For reference, to add a member to a group:

    {groupObject}.Members.Add({entityObject} as DirectoryObject);

    So for example, to update a group with a new user member:

    myGroup.Members.Add(userToBeAdded as DirectoryObject); await myGroup.UpdateAsync();

    NOTE: The same construct can be used to add users to a DirectoryRole object. Groups and users may be added to a group, however, for now, only users can be added to a DirectoryRole.

    Hope this helps,

提交回复
热议问题