cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Helper II
Helper II

Re: how-to Get and Update View properties via REST

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
Highlighted
Helper II
Helper II

Re: how-to Get and Update View properties via REST

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

Highlighted
Regular Visitor

Re: how-to Get and Update View properties via REST

where in power automate do you put this code?

Highlighted
Helper II
Helper II

Re: how-to Get and Update View properties via REST

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
Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (5,698)