0

I have a lookup column in my SharePoint online list. It is having a self lookup of the Yes/No column. my parent field is a Yes/No column and it is connected with a self lookup of another field in my same list. My source environment is SharePoint 2013, I have exported CSV data from these details. I am using PNP PowerShell to read the data from the CSV file move it into the online list. So how can I read the data from YEs/No column update it in the self look up the field in the same list?

1 Answer 1

0
ForEach ($Row in $CSVData)
{
    if($($Row.text))
    {
     $source_ID = Get-PnPListItem -List $List -Query "<View><Query><Where><Eq><FieldRef Name='fieldname'/><Value Type='Text'>$($Row.ID)</Value></Eq></Where></Query></View>" | Select ID
     $itemID=$source_ID.Id

     Set-PnPListItem -List $ListName -Identity $ItemID -Values @{internalname = $itemID} #updating self lookup
    }
}
1
  • I am checking some fields for an update, no need caml query all the item, just select the list item id and update in the look up field place
    – Liz
    Feb 15, 2022 at 2:21

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.