禁用旧版身份验证的PowerShell中的Sharepoint Online(O365)CSOM [英] Sharepoint Online (O365) CSOM from PowerShell with Legacy Authentication disabled
问题描述
在禁用旧式身份验证时,是否有人可以通过PowerShell的客户端对象模型在线连接到SharePoint?什么时候遗留协议被禁用,我在尝试创建客户端上下文时遇到此错误:
无法连接到(站点),异常调用"ExecuteQuery"带有"0"参数:无法联系网站(网站),或者网站不支持SharePoint Online凭据.响应状态代码为未授权".响应
标头为"X-SharePointHealthScore = 0,X-MSDAVEXT_Error = 917656;访问+拒绝.在此位置之前,打开文件+%2c +您+必须+首先+浏览+到+ Web +站点+并选择+选项+自动登录. /p>
这是我进行连接的方式,在启用旧式身份验证协议的情况下可以正常工作:
[System.Reflection.Assembly] :: LoadWithPartialName("Microsoft.SharePoint.Client")
$ ccCtx =新对象microsoft.sharepoint.client.clientcontext($ Sitename)
$ ccCtx.Credentials =新对象Microsoft.SharePoint.Client.SharePointOnlineCredentials($ UserName,$ Password)
$ ccCtx.ExecuteQuery()
在这里
https://blog.areflyen.no/2017/06/18/problem-with-connecting-to-sharepoint-online-in-office-365-with-powershell-sharepoint-designer-and-other-3 -party-tools/
Does anyone know if it is possible to connect to SharePoint online via Client Side Object Model from PowerShell when Legacy Auth is disabled? When the legacy protocols are disabled I get this error trying to create a client context:
Failed to connect to (site), Exception calling "ExecuteQuery" with "0" argument(s): "Cannot contact web site (site) or the web site does not support SharePoint Online credentials. The response status code is 'Unauthorized'. The response
headers are 'X-SharePointHealthScore=0, X-MSDAVEXT_Error=917656; Access+denied.+Before+opening+files+in+this+location%2c+you+must+first+browse+to+the+web+site+and+select+the+option+to+login+automatically.
Here's how I make the connection, which works fine with legacy authentication protocols enabled:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
$ccCtx = New-Object microsoft.sharepoint.client.clientcontext($Sitename)
$ccCtx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $Password)
$ccCtx.ExecuteQuery()
Here you go
https://blog.areflyen.no/2017/06/18/problem-with-connecting-to-sharepoint-online-in-office-365-with-powershell-sharepoint-designer-and-other-3-party-tools/
这篇关于禁用旧版身份验证的PowerShell中的Sharepoint Online(O365)CSOM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!