I am trying to add items to the comments list based on the Post list having lookup relation ship between these two lists,can any one give me an example how to update the lookup column values using powershell in sharepoint 2013


You can either use PowerShell formatting to provide a string representation, or create a new SPFieldLookupValue object:

$lookupValueString = "{0};#{1}" -f $post.ID,$post.Title
$lookupValue = New-Object Microsoft.SharePoint.SPFieldLookupValue -ArgumentsList $post.ID,$post.Title

Then you assign the value to a field and then Update the item.

$comment["PostTitle"] = $lookupValue
| improve this answer | |

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.