如何 运行 VSTS 上的 SharePoint Online PowerShell 脚本

How to Run SharePoint Online PowerShell scripts on VSTS

我需要从 VSTS Build 执行 SharePoint Online PowerShell 脚本。

在本地计算机的情况下,我们使用下面的命令执行创建列表等的 SharePoint Online PowerShell 脚本。

Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

我想我们需要用下面的替换上面的

Import-Module Microsoft.Online.SharePoint.Powershell

在构建的powershell任务中。

Import-Module Microsoft.Online.SharePoint.Powershell 的 Cmdlets 引用文件夹**C:\Program Files\SharePoint Online Management Shell* 中的文件* 在本地机器上。

我如何引用 SharePoint Online 管理 Shell 文件,并在 VSTS 构建任务中执行 PowerShell 脚本以在 SharePoint Online 上创建网站栏、列表等?

您可以在您的一台网络机器上设置私人代理。然后在上面安装所需的依赖项。这应该有效。

参考https://docs.microsoft.com/en-us/vsts/build-release/actions/agents/v2-windows?view=vsts了解如何操作。