c# - 将用户属性设置为 null 或 string.empty
问题描述
我正在尝试通过在 C# 应用程序中使用 Microsoft.Graph NuGet 包将 Azure AD 用户的值设置为 null 或 string.Empty。
那是我的代码:
public async Task<User> UpdateMobilePhone(string userId, string mobilePhone)
{
User user = new User();
user.MobilePhone = mobilePhone;
return await graphServiceClient.Users[userId]
.Request()
.UpdateAsync(user);
}
如果将“mobilePhone”的值设置为 string.Empty,则会收到错误消息:Microsoft.Graph.ServiceException:“代码:Request_BadRequest 消息:为资源“用户”的属性“mobilePhone”指定的值无效。
如果我将“mobilePhone”的值设置为空,它什么也不会发生,因为空用户的默认值为空,所以他认为,什么都没有改变。
那么有人知道我可以如何解决我的问题吗?
谢谢转发
解决方案
推荐阅读
- python - 使用函数的友好数字
- spring-security - 在创建请求期间使用资源属性中的当前授权用户
- javascript - 变量名附加到 json 而不是变量值
- pyspark - 实例化“org.apache.spark.sql.hive.HiveExternalCatalog”时出错
- c# - Word inerop c#:在word文件中查找和替换星号
- laravel - ngenius-payment 无法集成,我跟着 DOCS,但给了我错误。它应该转到付款页面
- c# - 使用 modbus rtu 并在 c# 中读取保存值
- oracle - oracle forms 12. 如何显示十进制数的前导零
- ionic-framework - 如何从代码中关闭 Ionic 5 应用程序?
- pandas - pandas grouby 根据多个条件对日期时间列进行计数