Issue updating fields in SharePoint document library using Office365 Activities

Hello everyone,

I’m facing a complicated situation working with Microsoft Office 365 activities (package version 2.5.9, cannot change the version).

In my robot, I access a SharePoint site with two lists. I filter both lists by an ID to identify:

  • In the first list, the item being processed.
  • In the second list, documents related to this item.

Updating fields in the first list (e.g., a Status field) works without issues. However, when I try to update fields in the second list (where there are documents), I get an “Invalid Request” error, even though I follow the same procedure.

My current steps are:

  1. Receive the ID of the item to process as an argument.
  2. Use Get List Info to get the columns of the list and a ListItems object.
  3. Apply an ODataFilter (fields/ColumnName eq ID) to filter results.
  4. Use a For Each to iterate through the filtered items (should return only one).
  5. Inside the For Each, update the field value like this:
ListItem.Fields.First(Function(f) f.DisplayName = in_SharepointField).Value = NewValue
  1. Call Update List Item with the modified item.

This works perfectly for the first list.

When I try to update the second list, which contains documents, and modify the Description field, I get an Invalid Request error.

Inspecting the variables, the item looks correct, only the value is changed:

Old Item: Office365SharepointListItem { ..., Fields=..., "Description"=null ... }  

Item after assign: Office365SharepointListItem { ..., Fields=..., "Description"="Signed" ... }

I suspect this could be because the item is a file/document, not a regular list item, but I’m not sure.

Has anyone faced a similar situation or knows how to update metadata fields in a SharePoint document library using UiPath Office 365 activities?

hii @agueda.prieto

The issue happens because files in a document library aren’t treated the same way as normal list items so the Update List Item activity wont work on them.

To update fields like Description, you need to use Update File Properties and pass the file’s ItemId along with the fields you want to change.

That’s the proper way to update document metadata in UiPath.

use update drive items

driveitem.ListItem.Fields(“Description”)=“signed”

Hi @agueda.prieto

The error appears because SharePoint document libraries treat items as files, not regular list items.

The Update List Item activity only works with normal lists, so it fails with “Invalid Request” when used on documents.

To update metadata fields example Description you need to use Update File Properties or Update Drive Item, which are designed specifically for file metadata in SharePoint.

Cheers

@agueda.prieto

Is the description another field in same list? or is it part of the file meta data?

one limitation we already know is about file type columns not being updated or exposed and also person type

if its a column…try to select the specific columns you need only and then update the field so that it does not retrieve all items

also if you open locals panel in debug mode you might get more info about the error

cheers

Hi everyone,

First of all, thank you for your replies! Unfortunately I can’t use “Update File Properties” or “Update Drive Item” in my project because I’m using version 2.5.9 of the Microsoft Office 365 Activities package, and those activities are not available in this version.

Also, I cannot update only specific columns, because when using “Update List Item”, I have to pass an Office365SharepointListItem variable as input.

Is it known if there are alternative ways to achieve the same result with this version of the package?

Hi @agueda.prieto

you can Use HTTP Request with SharePoint/Graph API to update the file metadata.

Cheers