在线将PowerShell连接到SharePoint 365

时间:2017-06-26 16:41:00

标签: powershell sharepoint

我尝试通过PowerShell在线连接到SharePoint 365,并且我一直收到此错误:enter image description here

这就是我输入的内容,我需要能够在SharePoint上编写脚本。

$adminUPN="***@***.com"
$orgName="****"
$userCredential = Get-Credential -UserName $adminUPN -Message "*******"
Connect-SPOService -Url https://******** -Credential $userCredential

2 个答案:

答案 0 :(得分:2)

在开始使用PowerShell管理SharePoint Online之前,请确保已安装SharePoint Online Management Shell。 通过下载并运行SharePoint Online Management Shell安装程序来安装SharePoint Online Management Shell。若要打开SharePoint Online Management Shell命令提示符,请从“开始”屏幕中键入sharepoint,然后单击“SharePoint Online Management Shell”。

答案 1 :(得分:0)

要使用SharePoint Online PowerShell脚本提高工作效率,请使用:SharePointPnP.PowerShel

安装:

如果主操作系统是Windows 10,或者安装了PowerShellGet,则可以运行以下命令来安装PowerShell cmdlet:

Install-Module SharePointPnPPowerShellOnline

<强>用法:

连接:

Connect-PnPOnline –Url https://yoursite.sharepoint.com –Credentials (Get-Credential)

创建列表:

New-PnPList -Title "Demo List" -Url "DemoList" -Template Announcements

命令文档

All commands documentation