Как проверить подлинность Office 365 SharePoint Online с включенным MFA в C# с помощью OfficeDevPnP.Core ⇐ C#
Как проверить подлинность Office 365 SharePoint Online с включенным MFA в C# с помощью OfficeDevPnP.Core
I am using OfficeDevPnP.Core to authenticate Office 365 SharePoint Online with MFA enabled but I am getting error
using (ClientContext ctx = new OfficeDevPnP.Core.AuthenticationManager().GetAzureADCredentialsContext(siteUrl, username, securePassword)) { // Your SharePoint Online operations go here // For example, retrieve the current user var currentUser = ctx.Web.CurrentUser; ctx.Load(currentUser); ctx.ExecuteQuery(); Console.WriteLine($"Authenticated user: {currentUser.Title}"); } Value cannot be null. Parameter name: value at Newtonsoft.Json.Linq.Extensions.Value[T,U](IEnumerable`1 value) at OfficeDevPnP.Core.AuthenticationManager.d__44.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at OfficeDevPnP.Core.AuthenticationManager.d__43.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at OfficeDevPnP.Core.AuthenticationManager.EnsureAzureADCredentialsToken(String resourceUri, String userPrincipalName, String userPassword, AzureEnvironment environment, KnownClientId clientId) at OfficeDevPnP.Core.AuthenticationManager.c__DisplayClass42_0.b__0(Object sender, WebRequestEventArgs args) at Microsoft.SharePoint.Client.ClientRuntimeContext.OnExecutingWebRequest(WebRequestEventArgs args) at Microsoft.SharePoint.Client.ClientContext.GetWebRequestExecutor() at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate() at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest() at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery() at Program.Main(String[] args) in C:\xxx\xxx\xxx\xxx\xxx\Program.cs:line 30 Any idea any one can help me out how I can Authenticate?
I have tried GetWebLoginClientContext I am able to authenticate but a pop up is coming every time i am uploading a file so i am trying alternative way to authenticate. So if any one can help me out in this using GetAzureADCredentialsContext
Источник: https://stackoverflow.com/questions/781 ... -sharp-usi
I am using OfficeDevPnP.Core to authenticate Office 365 SharePoint Online with MFA enabled but I am getting error
using (ClientContext ctx = new OfficeDevPnP.Core.AuthenticationManager().GetAzureADCredentialsContext(siteUrl, username, securePassword)) { // Your SharePoint Online operations go here // For example, retrieve the current user var currentUser = ctx.Web.CurrentUser; ctx.Load(currentUser); ctx.ExecuteQuery(); Console.WriteLine($"Authenticated user: {currentUser.Title}"); } Value cannot be null. Parameter name: value at Newtonsoft.Json.Linq.Extensions.Value[T,U](IEnumerable`1 value) at OfficeDevPnP.Core.AuthenticationManager.d__44.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at OfficeDevPnP.Core.AuthenticationManager.d__43.MoveNext() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at OfficeDevPnP.Core.AuthenticationManager.EnsureAzureADCredentialsToken(String resourceUri, String userPrincipalName, String userPassword, AzureEnvironment environment, KnownClientId clientId) at OfficeDevPnP.Core.AuthenticationManager.c__DisplayClass42_0.b__0(Object sender, WebRequestEventArgs args) at Microsoft.SharePoint.Client.ClientRuntimeContext.OnExecutingWebRequest(WebRequestEventArgs args) at Microsoft.SharePoint.Client.ClientContext.GetWebRequestExecutor() at Microsoft.SharePoint.Client.ClientContext.GetFormDigestInfoPrivate() at Microsoft.SharePoint.Client.ClientContext.EnsureFormDigest() at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery() at Program.Main(String[] args) in C:\xxx\xxx\xxx\xxx\xxx\Program.cs:line 30 Any idea any one can help me out how I can Authenticate?
I have tried GetWebLoginClientContext I am able to authenticate but a pop up is coming every time i am uploading a file so i am trying alternative way to authenticate. So if any one can help me out in this using GetAzureADCredentialsContext
Источник: https://stackoverflow.com/questions/781 ... -sharp-usi
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение