Currently have a process which reads all list items from a SharePoint list and this has been working fine for years using the activities on Marketplace which UiPath staff developed. We’ve had a Change Request to add some code to update any list items which get processed as a result of this job running, updating a new field called “Processed” and changing it from No to Yes. Even using the same SharePoint scope and testing by using the Get List Items activity we are struggling to update anything.
When we have it as below (with “Read, Write” selected in the properties of the SharePoint Scope) Get List Items works, and the first Update List Items doesn’t throw any errors, but the one in the For Each complains of “Update list items: Access denied. You do not have permission to perform this action or access this resource.”
However, although the first one doesn’t throw errors it doesn’t seem to work. All items show as having been updated by the VM this test process ran on within their version history, no change actually gets made.
Update List Item properties:
Prop Dictionary: New Dictionary(Of String, Object) From {{ “Processed”, “Yes”}}
CAMLQuery: “” - to hopefully just get all items
Has anyone successfully used this activity to update list items in SharePoint? We need to use these activities due to the version of SP being used, the more modern O365 activities don’t work.
Inside loop it might be throwing error in same scope because the queries are executed at once in this activity…so as the previous update might be conflicting
Apologies, looks like I screenshotted and shared info for the incorrect test file!
The error is: “Update list items: This field cannot be updated.”
CAML: "<Query><OrderBy><FieldRef Name='ID' Ascending='True'></FieldRef></OrderBy><Where><Eq><FieldRef Name='ID'></FieldRef><Value Type='Number'>"+ID+"</Value></Eq> </Where></Query>"
When we manually open SP we are able to Edit this field.
Updated item in prop dict to be our code from above (rather than using the variable) and it processed, however similar to before, although it shows as having worked, nothing in SharePoint actually updates to show Yes in that column?
Please ignore item variable, I updated that to be New Dictionary(Of String, Object) From {{ “Processed”, “Yes”}} instead as you can see in the latest screenshot, so it should only update the Processed field to Yes? As far as I know the CAMLQuery under Prop Dictionary defines which items are accessed, so to define that you need the ID in it?
The value is string, we’re updating it to “Yes”, if that’s what you mean?
The item variable is from the for each loop, so it’s actually the dictionary item for each ID line
I’m using "<Query><OrderBy><FieldRef Name='ID' /></OrderBy></Query>" in Get List and it grabs all items.
In Update all - "<Query><OrderBy><FieldRef Name='ID' Ascending='True'></FieldRef></OrderBy><Where><Eq><FieldRef Name='ID'></FieldRef><Value Type='Number'>"+ID+"</Value></Eq> </Where></Query>"
All the items in SharePoint show as the bot having updated them as this ran, but the Processed column still shows No.
When running it we got the output showing each ID was being updated and they tracked perfectly with the number of records we have in SP:
And as I said, in SharePoint, each item has “Last updated by bot at hh:mm:ss” every time we run it, so it is getting through to each item, just not actually updating them?