cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EmilioatUplyft
Helper II
Helper II

how-to Get and Update View properties via REST

Hi Gurus,

I'm using the following tutorial as the starting point for my question. https://michalguzowski.pl/add-fields-to-sharepoint-list-using-flow/ I got the example working correctly. 

 

I need help using the REST API to Get and Update the Views associated with Sharepoint Lists. In the above example, Michal uses Send HTTP requests to create SP Lists and dynamically add columns to those lists within an Apply To Each. His method works great, albeit a little hard to read still. 

 

What I need help with relates to the Views of the Lists not showing the API created columns by default. When I click on the SP List created in this method, the columns are hidden by default in the default View, so I have to edit each View and click the "Display" checkbox beside each column before they are visible.

 

I found the REST API to the Views: _api/web/lists/getbytitle(‘ListName’)/Views

and for fields: _api/web/lists(guid'8b40287a-da7b-46ac-b2ef-889ebdda957b')/fields('fe0871c8-0938-48a9-a9e3-4aa213a31bed')

Which produced a JSON of the columns and internal properties. 

 

But I've been unable to find how to use REST to Update the View properties. 

 

Any guidance is greatly appreciated!

create columns via RESTcreate columns via RESTcreate columns via RESTcreate columns via RESTNeed to set the columns to Display in their View.Need to set the columns to Display in their View.

 

1 ACCEPTED SOLUTION

Accepted Solutions
EmilioatUplyft
Helper II
Helper II

The author, Michal, was kind enough to provide a link to the missing documentation.

 

To get/set/delete view items: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn5314... 

 

Use the viewfieldcollection methods: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn5314...

 

To add a view field: 

<app web url>/_api/SP.AppContextSite(@target)/web /lists(guid'da58632f-faf0-4a78-8219-99c307747741') /views('d82d3e67-f317-413c-8f27-590317a40f20')/viewfields /addviewfield('AssignedTo')

 

 

 

View solution in original post

3 REPLIES 3
EmilioatUplyft
Helper II
Helper II

The author, Michal, was kind enough to provide a link to the missing documentation.

 

To get/set/delete view items: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn5314... 

 

Use the viewfieldcollection methods: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn5314...

 

To add a view field: 

<app web url>/_api/SP.AppContextSite(@target)/web /lists(guid'da58632f-faf0-4a78-8219-99c307747741') /views('d82d3e67-f317-413c-8f27-590317a40f20')/viewfields /addviewfield('AssignedTo')

 

 

 

View solution in original post

where in power automate do you put this code?

I have been working on a similar task. I have created the view, deleted all default columns, and added a column back in.

How do I add in multiple columns to my. 

This works...
_api/web/lists('@{variables('ListId')}')/Views('@{variables('ViewId')}')/ViewFields/addViewField('Title')

 

Surely I don't have add each column individually... with separate calls?

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (63,669)