如何使用 Microsoft Graph 客户端 SDK(C#) 重置密码? [英] How to reset password using Microsoft Graph Client SDK(C#)?
问题描述
用户如何使用 Microsoft Graph 客户端重置其密码.我无法找到正确的方法来做到这一点.谢谢.
How can a user reset his password using Microsoft Graph client. I am not able to find the right way to do it. Thanks.
推荐答案
Tom 对此表示正确,委托范围 Directory.AccessAsUser.All
允许登录用户更改其密码.标准的 User.ReadWrite
可以更新大多数属性,但它不能更新用户的密码.
Tom is correct about this the Delegate Scope Directory.AccessAsUser.All
allowing the signed-in user to change their password. The standard User.ReadWrite
can update most properties, but it cannot update the user's password.
但是,它是受支持的操作.SDK 包含您需要传递给 Graph 的 PasswordProfile
类.语法看起来像这样:
It is, however, a supported operation. The SDK includes the PasswordProfile
class you need to pass into Graph. The syntax would look something like this:
await graphClient.Me.Request().UpdateAsync(new User() {
PasswordProfile = new PasswordProfile() {
Password = "newPassword",
ForceChangePasswordNextSignIn = true
}
});
这篇关于如何使用 Microsoft Graph 客户端 SDK(C#) 重置密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!