Can't Update Users with GraphServiceClient

三世轮回 提交于 2020-01-23 10:39:08

问题


My problem is exactly what it says in the title. If I want to interact with users using MicrosoftGraph, I have a few options:

graphClient.Users.Request.GetAsync()
graphClient.Users.Request.AddAsync()

I would like to see:

graphClient.Users.Request.UpdateAsync()

Unfortunately, my problem is that I don't see it. Where is it? I see UpdateAsync on a few other objects... why is it not on users? Did I miss some crucial piece of documentation?


回答1:


It is on User. You're missing a few things. You haven't identified the user, use the indexer. Also, Request is a method, not a property.

var betterMe = new User()
{
   GivenName = "Super Man"
};

// Update the user to Super Man
await graphClient.Users[myId].Request().UpdateAsync(betterMe);


来源:https://stackoverflow.com/questions/43747050/cant-update-users-with-graphserviceclient

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!