#StackBounty: #powershell #csom #project-server Get Selection from Lookup Table CSOM PowerShell in Project Server

Bounty: 50

I have a custom field at the project level that is a lookup table (single select). I cannot for the life of me figure out how to get the value of the selection from the lookup table. I can get the lookup table:

$lookupTables = $projContext.LookupTables

$myLookupTable = $lookupTables.GetByGuid('GUID FOR LOOKUP TABLE')

and I can get the field:
$custFields = $project.CustomFields

$myField = $custFields.GetByGuid([Guid]"{GUID FOR FIELD}") 
$projContext.Load($myField )

When I look at values in myField everything looks ok. I can see the .LookupDefaultValue but when I try to get the selection of the Field, I’m not quite sure what to do. I’ve Tried:

$myfieldvalue = new-object Microsoft.SharePoint.Client.FieldUserValue($myField).LookupValue

But it comes out as Microsoft.SharePoint.Client.FieldUserValue

I’ve tried

$myfieldvalue = $myField .Value
$projContext.Load($myfieldvalue )

but that blows up on the Load.

Get this bounty!!!

Leave a Reply