cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft Graph - SharePoint VBO Challenges

Kamal2017
Level 4
Hi Team,

I am looking for your help on 
Microsoft Graph - Sharepoint connector web API - action 'Update List Item Column Value'. I am able to run this successfully with request payload in json format as per the ask. However it looks that it doesn't update the new value/s.

I tried it multiple times with success but the response recieved from that call still holding the old value/s.

Anyone know if this action really works or I am doing something incorrectly ?




------------------------------
Kamal Ahmed RPA Developer
Sr. Programming Analyst
BNY Mellon
Asia/Kolkata
------------------------------
1 BEST ANSWER

Helpful Answers

@Kamal2017,

Ok, apparently my brain is not working. 😂

If you're using the Update List Item Column Values action, on the connector, there's no need to include the @fields portion in the JSON body because it's already included in the URL path. See the following screenshot:

8731.png
Set up your JSON body to just include the field names and their values like this:

{
  "Title": "Success"
}
​
Cheers,
​

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

View answer in original post

19 REPLIES 19

ewilson
Staff
Staff
@Kamal2017,

This seems to work for me on my test SharePoint site. One thing you might want to check is the properties of the field (aka Column) you're trying to update. They can be marked as read-only. They can also have an associated calculation that must be met for things to work properly. Not sure if these apply to your specific case, but you should verify.

In my case, I added a Single Text Line column, named Test Column, to an existing list of documents as pictured below:
8695.png After that, I used the Graph action to update the value of the column on the item Test1.xlsx to set the value to This is a test as shown below:
8696.png
And this is the JSON I used:
{
    "TestColumn": "This is a test"
}​
 
Please note, the name you use to reference the column in the JSON, is NOT the displayName (i.e. the displayed name of the column). It's the name (i.e. internal name). You can find the name of the column by enumerating the list's columns. We don't have an action in the connector for that, but you can add one easy enough. Just copy the Get List by List ID action and add /columns to the end of the URL Path:

/sites/[Site ID]/lists/[List ID]/columns

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi Eric,

Thanks for your response. I think i got few things from your suggestion and probably will try doing this.

Just a small update, I am trying to update a column value in a list (Table) and this is the json i am trying to use:
JSON (Request Payload) = {"@fields":{"Title":"Test"}}
Table: List with multiple columns - 30+ columns
Field Name: It looks to be same on the list as well as collection i got from action 'Get Items in List by Fields' (attached for ref.)



------------------------------
Kamal Ahmed RPA Developer
Sr. Programming Analyst
BNY Mellon
Asia/Kolkata
------------------------------

Hi Eric,
@ewilson

Looking for your assistance on the above issue with MS Graph API for updating field/s on a list/table in SharePoint online.​​​

------------------------------
Kamal Ahmed RPA Developer
Sr. Programming Analyst
BNY Mellon
Asia/Kolkata
------------------------------

Hi @Kamal2017,

Can you update me on your latest status? There were some suggestions I made that you were going to try. I take it they didn't help you move forward?

Cheers,
​

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi @ewilson,

Yes, you are right, i think i missed to post that updates. I am able to make this action call working with correct json and getting the success result however it is not reflecting the update on field/s made on the SharePoint. So, was wondering if this action really works or I am doing something wrong.

Attached is the action details.   â€‹

------------------------------
Kamal Ahmed RPA Developer
Sr. Programming Analyst
BNY Mellon
Asia/Kolkata
------------------------------

@Kamal2017,

Ok, I understand what you're trying to do. I thought you were trying to change the value of an item within the list when in fact you're trying to change the definition of an actual column. The bad news is there's no action on the SharePoint connector, at the moment, to change the definition of a list column. The good news is that it's not that difficult to add one.

What you want to do here is issue a PATCH request against the column definition. Microsoft recommends creating a JSON payload that only includes the specific column properties that you want to update. In this case, the only thing you want to update is displayName from the sounds of it.

First, you issue a GET request to enumerate the column definitions for the specific List that you want to work with. I mentioned that in my post from Feb 3rd where I mentioned you would need to add an action for this. The action looks like this:

GET /sites/[Site ID]/lists/[List ID]/columns

The response will include an array of JSON objects that correspond to each column in the List. Find the information for the column you're interested in and pull out its ID. Now, you'll use that ID with a PATCH request to update it. The request looks like this:

PATCH /sites/[Site ID]/lists/[List ID]/columns/[Column ID]

And the request body, for displayName, would look like this:

{
  "displayName": "[New Column Name]"
}​


Here are some screenshots from a test I ran. The first shows the original file list. The second shows what it looks like after I changed the name of the column titled Test Column.

8705.png
8706.png
NOTE:
If you're looking at this in the browser, you have to refresh the page to see the update.


Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi @ewilson,

I am trying to change the value of an item within the list only. For example: The Title value for Row 1 is "Failed" and I am trying to update this to "Success".  The definition of an actual column will remain same i.e. Column name will still be "Title" only.

JSON (Request Payload) = {"@fields":{"Title":"Success"}}
​

------------------------------
Kamal Ahmed RPA Developer
Sr. Programming Analyst
BNY Mellon
Asia/Kolkata
------------------------------

@Kamal2017,

Ok, apparently my brain is not working. 😂

If you're using the Update List Item Column Values action, on the connector, there's no need to include the @fields portion in the JSON body because it's already included in the URL path. See the following screenshot:

8731.png
Set up your JSON body to just include the field names and their values like this:

{
  "Title": "Success"
}
​
Cheers,
​

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hi @ewilson,

Yes, finally it worked. Thank you for all your assistance and support. 🙂 ​

------------------------------
Kamal Ahmed RPA Developer
Sr. Programming Analyst
BNY Mellon
Asia/Kolkata
------------------------------