Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用C中的Windows应用程序在SharePoint中上载文件时出现异常#_C#_Sharepoint_Sharepoint Online - Fatal编程技术网

C# 使用C中的Windows应用程序在SharePoint中上载文件时出现异常#

C# 使用C中的Windows应用程序在SharePoint中上载文件时出现异常#,c#,sharepoint,sharepoint-online,C#,Sharepoint,Sharepoint Online,我想使用C#中的Windows应用程序在SharePoint中上载文件 但我得到了以下错误: Microsoft.SharePoint.Client.IdcrlException: 'The sign-in name or password does not match one in the Microsoft account system.' 但是,当我将这些凭据手动键入SharePoint网站时,它们工作正常。如果启用多因素身份验证(MFA),您将收到此错误消息 您需要使用下面的命令安装

我想使用C#中的Windows应用程序在SharePoint中上载文件

但我得到了以下错误:

Microsoft.SharePoint.Client.IdcrlException: 
'The sign-in name or password does not match one in the Microsoft account system.'

但是,当我将这些凭据手动键入SharePoint网站时,它们工作正常。

如果启用多因素身份验证(MFA),您将收到此错误消息

您需要使用下面的命令安装软件包

Install-Package SharePointPnPCoreOnline -Version 3.17.2001.2
然后使用下面的代码连接SharePoint Online

var authManager = new AuthenticationManager();
var client = authManager.GetWebLoginClientContext("https://jithin32.sharepoint.com/sites/demo");

参考:Office 365:

错误很明显。名称或密码有误。这与上载无关。我可以使用相同的用户名和密码登录。错误说明您使用了错误的用户名和密码。我有相同的问题,而MFA是LZ_MSFT指出的问题。但是我仍然需要一个可以作为服务运行的应用程序,以便能够将文件移动到sharepoint。到目前为止,我发现的工作示例都需要您输入信息。如何在无人参与的情况下完成此操作?SharePointPnPCoreOnline已被弃用,建议您改用PnP Framework()
var authManager = new AuthenticationManager();
var client = authManager.GetWebLoginClientContext("https://jithin32.sharepoint.com/sites/demo");