如何使用Powershell将企业资源添加到Project Online。卡住没有运气

时间:2019-10-13 13:30:35

标签: powershell csom

添加类型-路径'C:\ Users \ klkc510 \ Downloads \ DeleteResources \ bin \ Microsoft.ProjectServer.Client.dll' 添加类型-Path'C:\ Users \ klkc510 \ Downloads \ DeleteResources \ bin \ Microsoft.SharePoint.Client.Runtime.dll' 添加类型-Path'C:\ Users \ klkc510 \ Downloads \ DeleteResources \ bin \ Microsoft.SharePoint.Client.dll'

$ pwaPath =“” $ projContext =新对象Microsoft.ProjectServer.Client.ProjectContext($ pwapath) $ UserName =“” $ Password =“”

$ credentials =新对象Microsoft.SharePoint.Client.SharePointOnlineCredentials($ UserName,(ConvertTo-SecureString $ Password -AsPlainText -Force))
$ projContext.Credentials = $ credentials

$projContext.Load($projContext.EnterpriseResources)
$projContext.ExecuteQuery()  
$erp = $projContext.EnterpriseResources
$enterprise_resourceid = [Guid]::NewGuid()
$resname = "Test"
$body = {parameters:{'Id:$enterprise_resourceid"",Name:$resname}}
$erp.Add.$body
Write-Host("Deleted Resource: " +  $body.Id)
$erp.Update()
$projContext.ExecuteQuery()
$projContext.Load($projContext.EnterpriseResources)

0 个答案:

没有答案