cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Create a new column in SharePoint list from Flow

Hello all,

 

So I have pre-existing lists that I would like to automate the process of creating a new column on. Can you automate this process with Microsoft Flow?

 

More Details:

I have about thirty lists that I would like to not have to manually go into and create two new columns, as mulitple sources will continue to create more lists overtime. The photo attached shows the two columns I create highlighted in red ink.Screenshot of ColumnsScreenshot of Columns

All help is appreciated!

 

Update: This link provides great examples for accomplishing this type of thing https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-rest-reference/dn6001...

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

 

Yes need to include the JSON request. Please see below. Here I am creating a new text column called 'Country' with field length 25 under the list called 'aj'.

 

sp2.png

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

12 REPLIES 12
yashag2255
Dual Super User II
Dual Super User II

Hi @Anonymous 

 

Creating a column in a sharepoint list is not supported as a direct action in flow currently. What you can do is, to create the two columns in every list in your sharepoint site, you can invoke the rest api using the "send an http request" to sharepoint action and create those columns. Here is an example of how you can invoke the rest api to create a column:

https://www.c-sharpcorner.com/article/how-to-create-column-in-a-list-using-rest-api-in-sharepoint/

More on SharePoint rest api options: 

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoint-rest-endpoints

 

The flow configuration can be: Manual button trigger -> Get Lists from Sharepoint Action -> Apply to each on the List returned -> send an http request to sharepoint.

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Anonymous
Not applicable

So, I can include non-JSON code into the body of a "Send Https request to Sharepoint" and populate the list with the two newly created columns (ex. pulling code from the link's example)? Or, are you saying I need to use the request to call an outside SharePoint Custom Add-in that is created similar to this: https://www.c-sharpcorner.com/article/how-to-create-column-in-a-list-using-rest-api-in-sharepoint/ to achieve the creation of columns?

 

@yashag2255 

Hi @Anonymous ,

 

Yes need to include the JSON request. Please see below. Here I am creating a new text column called 'Country' with field length 25 under the list called 'aj'.

 

sp2.png

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

Hi @Anonymous 

 

You can refer to @abm 's suggestion for the send an HTTP request to sharepoint action. You can variabalise the column names / use the dynamic selector if you want to extract those from elsewhere.  

 

You can get more details on the column types and sending http request to invoke the SharePoint REST API from the URL's that I have shared earlier. 

 

More on column types etc. here: 

https://support.office.com/en-gb/article/list-and-library-column-types-and-options-0d8ddb7b-7dc7-414d-a283-ee9dca891df7

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Tom_Slosse
Memorable Member
Memorable Member

Hey all

 

 

Some more information on the different FieldTypes could come in handy for this one I think 🙂

https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-visio/jj245640%28v%3doffice.15%...

 

Kind regards

 

Tom Slosse



If this reply has answered your question or solved your issue, please mark this question as answered.

Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

Is there any way to make the column visible by default?  The HTTP request worked for me, but the new column is hidden.

Hi

 

Once the column is created you need to execute another HTTP POST

 

http://<sitecollection>/<site>/_api/web/lists(listid)/Views(viewid)/ViewFields/addViewField(strField...

 

https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-visio/jj246043(v%3Doffice.15)

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
J8
Frequent Visitor

Hi,

 

I am trying the same approach here but with newly added column field as choice type.

Power_Automate_Choice.PNG

 

I manage to get it run successfully with new "Phase" column added:

Power_Automate_Phase.PNG

 

However, it won't update or display in the list:

Power_Automate_Phase2.PNG

 

How do I get it it to display once added with power automate?

Power_Automate_Phase3.PNG

J8
Frequent Visitor

Hi @maxwn5, have you found a solution to display the hidden column by default?

The link shared by @abm is no longer reachable.

Thanks.

abm
Super User
Super User

Hi @J8 

 

You need to change the view manually.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials
DAAZEVEDO
Frequent Visitor

.

DAAZEVEDO
Frequent Visitor

Hi @J8 ,

 

You need to creat a new HTTP request w/ POST method to add this (or all columns creates) to the default view.

 

Try w/ this Uri = _api/web/lists/GetByTitle('YOUR_LIST_NAME')/views/getbytitle('All Items')/ViewFields/AddViewField('YOUR_ColumnName')

 

DAAZEVEDO_0-1620598910385.png

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (1,917)