2

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

1 Answer 1

1

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
$comment.Update()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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