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

Check if a Column Exists in Document Library

Hi All,

I have a use case where in i would want to check dynamically in a document library if a column exists in that particular library and if not create that particular column.

is that possible through power automate?

Any help would be appreciated.

1 REPLY 1
Expiscornovus
Super User
Super User

Hi @Jayant_2203,

 

Yes, that would be possible. You could retrieve the existing columns via an Send an HTTP action and the Fields method in the REST API and use a filter array to check if your custom column already exists.

 

Below is an example of that approach.

 

1. Send an HTTP request uses this URI. In this example I am using a string variable ListName which is storing the name of the list.

_api/web/lists/getbytitle('@{variables('ListName')}')/Fields

 

2. Filter Array uses the results collection of the output body.

outputs('Send_an_HTTP_request_to_SharePoint')['body']['d']['results']

 

In the where I am comparing the InternalName of the field to the name of our custom field. In my example that name is stored in a string variable called FieldName.

item()['InternalName']

 

sendanhttprequest_filterarray.png

 

When the output of the Filter Array is empty you could create the new column.

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,458)