Getting "Microsoft.SharePoint.Client.FieldUserValue" with Get List Items Sharepoint activity

NOTE: Solution for insert in the post: How to retrieve value of the column instead of Microsoft.SharePoint.Client.FieldUserValue - #7 by Airun

Hi all,

In my company, we use Sharepoint list to request services to teams like IT, Marketing, HHRR, Quality and so on…

I want to automate some of those requests and, a very useful thing could be to obtain all the open requests form data without opening physically each list item so I’m trying with a “Get List Item” activity. But, for some of our forms data I’m getting “Microsoft.SharePoint.Client.FieldUserValue” so impossible to interact with it.
Sometimes I need to extract the name of the requester, or assign the request to someone by insertig the name of the employee on the field “ASIGNEDTO”. Sow can I do it?

How can I convert this data into a simply Generic Value or into String, Boolean, Int32…?

Example:

This is our Sharepoint List Item form:

This is what I get with the Get List Item Sharepoint activity if I write it on an excel, for example:


image

I’ve tried to convert this value to string, with an Invoke Method activity without success, by using sentences like “row(“REQUESTER”).ToString” or “row(“REQUESTER”).Value.ToString” without success. And, at the same time, I have no idea about how to insert a name (as Nuria Santos Carbonell" on "ASIGNEDTO field who’s type is FieldUserValue and not String.

I’vo found two or three topis about it on the forum but I can’t find a solution for my issue on any of them. :disappointed_relieved:

1 Like

Hi, there!

The SharePoint CSOM is rather complicated. But here is how you can do it.

First, make sure you are using the latest version of the UiPathTeam.SharePoint.Activities package. Should be 1.5.2 or later.

Next, you won’t be able to get the value from the DataTable. You’ll have to get the list using the Dictionary option. So for the Get List Items activity, use the Items(Dictionary Array) option.

Then you can get the value by doing something like:

CType(OutputDict(0)("REQUESTER"), Microsoft.SharePoint.Client.FieldUserValue).LookupValue

This will give you the value of the FieldUserValue as a String.

Hope that helps!

3 Likes

Thanks, this part works fine to extract the data. I will need to modify again all the process to assign the queitems (I was using a bulk adding the data table of all the sharepoint list items) but at least I can obtain the data correctly.

What I’m still not able to do is to update those fields to assign someone to the “ASIGNEDTO” field for example. I receive this error:

How I must manipullate the name to insert it as a FieldUserValue?

I’ve tried some possibilities with information found on:

and

Without any success.

It indicates me that a string cannot be converted to FieldUserValue. I’ve tried with Assign activities with different expressions, with an invoke method and an invoke code but I’m not able to convert it so I can’t fill the field.

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