0

I have trying to add new item via powershell to a list that has a column with a lookup to another list

    $NewItem = $list.Items.Add()

    #Add properties to this list item
    $NewItem["Title"] = "$($Title)"
    $NewItem["Connections"] = "Connection1"

    #Update the object so it gets saved to the list
    $NewItem.Update()

But l keep getting "Invalid look-up value" The "Connections" is the column that had a lookup value to the connections list

Not sure how to reference the lookup value called "Connection1"

1 Answer 1

1

Finally figured it out if anyone wants to know.

I needed a reference to the ID of the item:

$listLookupitem = $ListLookup.GetItemById(4)

$NewItem["Connection"] = [string]$listLookupitem.ID + ";#" + $listLookupitem.Title

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.