Can’t update Sharepoint ListItem in C#-project

Hello.

I have a project where I download a Sharepoint list. I then have a For Each Item in List, where I iterate through it. I then add all ListItems to a dictionary, and I get exactly what I want. (Microsoft 365 Classic-activities)

My issue is when I want to update certain ListItems, because as far as I understand I would want to use an assign activity and have “field.Value = “New value” (given that I have another for each loop inside the first one, where field is the item in a list of ListItem.Fields, and the “Update List Item”-activity with ListItem as value.

This works in VB-projects, but not in my C#-project. How do I achieve this in my C#-project?

Hi,

Can u please share your current workflow screenshot, and the error screenshot for us to understand your problem better.

Thanks

Thank you so much for your reply!

Sadly, I am not allowed to share any screenshots from the workflow, but I will explain it better.

I have a working solution, using Microsoft 365 Classic activities for Sharepoint with VB as the language. In that one, I get the Sharepoint lists, and iterate through them using the “For Each List Item” activity - where “Office365SharepointList” is the list, and “ListItem” is the item.

Inside that one, I have another “For Each” loop, where the list is “ListItem.Fields” and the item is “field”.

Inside there, i am able to reach all the values I want, using “field.Value”. I am also able to update the values, using an assign activity, so for example “field.Value” = “New text”, and then I use an “Update List Item” activity.

When I run the robot, the actual Sharepoint list is being updated. (Can confirm it by refreshing the webpage).

However, the project I need to implement this solution to, is written with C# as the language. So I am not able to reach or update the values the same way.

In this project, I still download the lists and iterate through them using a “For Each List Item” activity - where list is “Office365SharepointList” and item is “ListItem”. But in this one, I add a dictionary - let’s call it “dict”. This way, I am able to read the values using “dict(“Column1”).ToString” for example. All good so far.

BUT - while I am able to update the values in the dictionary, I am not able to actually update the values in the Sharepoint list. Since I do not seem to be able to use the same approach with another “For Each” loop to iterate through “ListItem.Fields” with “field” as item, and then update “field.Value” before I push the list. So what I am after, is a way to make the changes and then update the Sharepoint List.

The error messages I get are just telling me that “.Value” is not a property of “field” and that kind.