SharePoint List- reading Data ok, but I'm not able to loop over the Dictionary

Community Edition: 2020 4.0 beta 250
I use the UIPath SharePoint activities. I can write data to the SharePoint list. But if I want to read the data with the Read function, I always get an error in the For Each loop that the data cannot be converted.

The data is read with: system.Collections.Generic.Dictionary (System.String, System.Object)
I change the type in my For Each loop to: systems.collection.generic.KeyValuePair <System.String, System.Object>

Error: For Each the specified conversion is invalid
I wanted to output data into a message box with: item.Key + vblf + item.Value.ToString.

How can I get the data in the dictionary structure system.Collections.Generic.Dictionary (System.String, System.Object)
read again?

in for each loop → convert your object variable(item) to specified type like string/list(based on your activity expected type)

You can’t write item.Value.ToString for an object.

Or

Change your SharePoint activity output as<String, String>

Thank you for your prompt reply.
Unfortunately I cannot change the output, as it is given by the SharePoint activity “Read list Items”. Do you have to do this conversion for each column?

I wanted to do the conversion to For Each using the Type argument. There I defined KeyValuePair String, Object.

Could you please give an example of how I can do this conversion in the For Each loop?

@Michael_Boeckenhauer Can you Show us the Screenshot of the Workflow?

image
image
The SharePoint Activities “READ List” function returns this format:
System.Collections.Generic.Dictionary<System.String, System.Object>

The solution is to change the TypeArgument in the For Each Loop to the same Format:
System.Collections.Generic.Dictionary<System.String, System.Object>

Now I get the Values of the item.
Thank you!

1 Like

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