无法使用 GraphServiceClient 更新用户 [英] Can't Update Users with GraphServiceClient

查看:26
本文介绍了无法使用 GraphServiceClient 更新用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题正是标题中所说的.如果我想使用 MicrosoftGraph 与用户交互,我有几个选择:

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()

我想看看:

graphClient.Users.Request.UpdateAsync()

不幸的是,我的问题是我没有看到它.它在哪里?我在其他一些对象上看到了 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?

推荐答案

它在用户上.你错过了一些东西.您尚未识别用户,请使用索引器.此外,Request 是一种方法,而不是属性.

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

这篇关于无法使用 GraphServiceClient 更新用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆