cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
marial16
Post Partisan
Post Partisan

Create calculated field with http request

Hallo,

 

I have created a flow that creates Lists in SharePoint. One of the columns is calculated.

I know the type of the column, but is there a way i can automatically create the calculation itself?

Example

 

marial16_0-1656513620342.png

 

marial16_1-1656513648437.png

 

marial16_2-1656513692409.png

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @marial16,


You can use the SP.FieldCalculated type in your metadata. 


Below is an example of that approach.

In this example I am also setting the output as a number. If you want to use text use the outputtype 1. 

https://docs.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.spfieldtype?view=sharepoint-server

 

 

{ 
"__metadata": { "type": "SP.FieldCalculated" }, 
"FieldTypeKind": 17, 
"Title":"TotalCost",
"Formula": "=Quantity*Cost", 
"OutputType": 9 
}

 

 

createcalculatedcolumn_restapi.PNG



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


View solution in original post

2 REPLIES 2
Expiscornovus
Super User
Super User

Hi @marial16,


You can use the SP.FieldCalculated type in your metadata. 


Below is an example of that approach.

In this example I am also setting the output as a number. If you want to use text use the outputtype 1. 

https://docs.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.spfieldtype?view=sharepoint-server

 

 

{ 
"__metadata": { "type": "SP.FieldCalculated" }, 
"FieldTypeKind": 17, 
"Title":"TotalCost",
"Formula": "=Quantity*Cost", 
"OutputType": 9 
}

 

 

createcalculatedcolumn_restapi.PNG



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Yes this works,

i figured it out eventually although i did not know about output type. 

I will add it also to the workflow.

 

Thank you!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,509)