创建用户时出错 {"odata.error":{"code":"Request_BadRequest"
Error when creating a user {"odata.error":{"code":"Request_BadRequest"
我正在尝试使用 ADAL 创建 Azure Active Directory 用户,但出现此错误:
{"odata.error":{"code":"Request_BadRequest","message":{"lang":"en","value":"Property value is required but is empty or missing."},"values":null}}
堆栈跟踪:
at System.Data.Services.Client.SaveResult.HandleResponse()
at System.Data.Services.Client.BaseSaveResult.EndRequest()
at System.Data.Services.Client.DataServiceContext.EndSaveChanges(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.ActiveDirectory.GraphClient.Extensions.DataServiceContextWrapper.<SaveChangesAsync>d__74.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at CapatechSaasApp.Areas.GlobalAdmin.UsuarioController.<Create>d__3.MoveNext() in C:\Proyectos\xx\xx\Areas\GlobalAdmin\Controllers\UsuarioController.cs:line 143
我的代码主要是从这个示例中复制粘贴:
我尝试通过代码设置语言:
user.PreferredLanguage= "en"
但这没有任何区别,错误没有说明必须设置哪个 属性。
几次尝试后,我发现我缺少要设置的 属性 AccountEnabled,很奇怪消息不够清楚,应该说缺少哪个 属性 值
我正在尝试使用 ADAL 创建 Azure Active Directory 用户,但出现此错误:
{"odata.error":{"code":"Request_BadRequest","message":{"lang":"en","value":"Property value is required but is empty or missing."},"values":null}}
堆栈跟踪:
at System.Data.Services.Client.SaveResult.HandleResponse()
at System.Data.Services.Client.BaseSaveResult.EndRequest()
at System.Data.Services.Client.DataServiceContext.EndSaveChanges(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.ActiveDirectory.GraphClient.Extensions.DataServiceContextWrapper.<SaveChangesAsync>d__74.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at CapatechSaasApp.Areas.GlobalAdmin.UsuarioController.<Create>d__3.MoveNext() in C:\Proyectos\xx\xx\Areas\GlobalAdmin\Controllers\UsuarioController.cs:line 143
我的代码主要是从这个示例中复制粘贴:
我尝试通过代码设置语言:
user.PreferredLanguage= "en"
但这没有任何区别,错误没有说明必须设置哪个 属性。
几次尝试后,我发现我缺少要设置的 属性 AccountEnabled,很奇怪消息不够清楚,应该说缺少哪个 属性 值