powershellprojectcsomms-project-server-2016

Powershell CSOM - to update Project Department look-up field Value


I wanted to update Project Department Ent Custom Field value, which is of type look-up field- ... from a csv file via/using powershell /csom. Many projects have department field to be updated/modified & I am looking to do this by some powershell script.

But I have no luck to push Dept value from csv into project server Field (Project Department)

[Array]$MyArray1 = $_.Dept
$draftProject.SetCustomFieldValue($Dept,$MyArray1)

Ref - https://gallery.technet.microsoft.com/projectserver/Update-Server-Custom-Field-00ab99a9

Appreciate any idea ... Thanks


Solution

  • go to pwaurl/pwa/_api/ProjectServer/CustomFields then search for Project Department You are looking for its internalName usually like: custom_Guid.

    Project department needs to be passed as an array, with text values replaced with their guid