Update Sharepoint list column using column name with Office 365

while updating a list item in SharePoint using Office365 activities, I following below steps

Get list info
For each list item (applied filters)
listitem.fields(40).value = “test”
Update List item

this was working fine in some projects, but I had a issue with another list where the index keep changing. So I am searching for solution to update List value based on column name instead of index

Thanks in Advance!

@Sreelatha278

For that you can get the required index by using a for loop on the retrieved values

Listitem.fields

And then use if condition to check the fieldname currentitem.DisplayName.Equals("Requiredname")

And on then side use the assign as needed

Or you can directly use this in assign

ListItem.Fields.Where(function(x) x.DisplayName.Equals("Display Name of Field"))(0).Value = "Value to be updated"

instead of displayname use name if you want to use the backend names of the fields

Cheers

Thanks Anil! it worked

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.