2

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
$projContext.Load($lookupTables)
$projContext.ExecuteQuery()

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

and I can get the field: $custFields = $project.CustomFields $projContext.Load($custFields) $projContext.ExecuteQuery()

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

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 )
$projContext.ExecuteQuery()

but that blows up on the Load.

0

Mark,

Take a look at this example on how to update lookup table values. I think it could help you move in the right direction.

Update Project Server 2010 / 2013 Lookup table with values from a text file

Here's an example in C# that may help also.

How To Read The Values Of Fields Bound To Lookup Tables Via The Client Object Model

Take a look at this example using REST to query Project Server.

Using PowerShell And REST With Project Server (Or SharePoint) For Reporting

  • I looked at that, but that article focuses on the lookup tables, and not the field that uses the lookup tables. I can find lots of examples of writing, but none of reading the values from the fields that use lookup tables. Seems like the reading should be the easy part. – Mark Mar 12 '18 at 14:01
  • Mark, you may want to contact the author of the solution above. I'm sure he'll have some ideas for you. – jpollar Mar 12 '18 at 15:15
  • I have done that. Hopefully he will answer. I am shocked at how difficult this is and that no one knows how to do this. – Mark Mar 14 '18 at 19:39
  • I don't have project server, so I have no way to test any of my suggestions. Sorry. – jpollar Mar 14 '18 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.