使用多重身份验证连接到SharePoint Online网站的C#代码 [英] C# code that connects to SharePoint Online site using Multi-Factor Authentication

查看:224
本文介绍了使用多重身份验证连接到SharePoint Online网站的C#代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我们有一个使用的Office 365环境
多重身份验证。当用户键入其用户名和密码到SharePoint在线站点时,还会向他们发送带有附加密码的文本消息。


我要做的是编写一个连接到SharePoint在线环境的C#Windows桌面应用程序,使用
多重身份验证。



有人可以发送网站网址或C#代码来演示如何使用
<创建一个简单的Windows桌面应用程序span name ="x_x_x_x_subject">多重身份验证。


我希望你能提供帮助!

Colin

解决方案


设置多个对用户进行因子身份验证,构建
  ClientContext以连接到SharePoint Online网站时,如果我们仍然将用户名+密码传递给SharePointOnlineCredentials对象,则会出现这样的错误消息:



因此,我们需要将用户名+应用程序密码传递给SharePointOnlineCredentials对象。


"应用程序密码,是在Azure门户中创建的密码,允许用户绕过多因素身份验证并继续使用他们的申请"。


有关多因素身份验证中应用密码的更多信息:


https://support.office.com/en-us/article/Set-up-multi-factor-authentication-for-Office-365-8f0454b2- f51a-4d9c-bcde-2c48e41621c6


有关如何使用SharePointOnlineCredentials对象连接到SharePoint Online网站的演示供您参考:


http://www.vrdmn.com/2013/01/authenticating-net-client-object-model.html


感谢

Hi All,

We have an Office 365 environment that uses Multi-Factor Authentication. When a user types in their username and password to the SharePoint online site, they are also sent a text message with an additional password.

What I am trying to do is write a C# Windows desktop application that connects to the SharePoint online environment using the Multi-Factor Authentication.

Can someone please send either a website url or C# code that demonstrates how to create a simple Windows desktop application that uses
Multi-Factor Authentication.

I hope you can help !
Colin

解决方案

Hi,

After set up multi-factor authentication for an user, when constructing  ClientContext to connect to SharePoint Online site, if we still pass the username + password to SharePointOnlineCredentials object, there will be an error message thrown like this:

Thus, we will need to pass the username + App Password to SharePointOnlineCredentials object instead.

"An app password, is a password that is created within the Azure portal that allows the user to by-pass the multi-factor authentication and continue to use their application".

More information about App Password in multi-factor authentication:

https://support.office.com/en-us/article/Set-up-multi-factor-authentication-for-Office-365-8f0454b2-f51a-4d9c-bcde-2c48e41621c6

A demo about how to connect to SharePoint Online site with the help of SharePointOnlineCredentials object for your reference:

http://www.vrdmn.com/2013/01/authenticating-net-client-object-model.html

Thanks


这篇关于使用多重身份验证连接到SharePoint Online网站的C#代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆