如何使用Microsoft Graph Client 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 Client SDK(C#)重设密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!