cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LinkToTheAsh_
Frequent Visitor

Check if SharePoint Rest API results are blank

Hi All,

I have a flow where I am testing if a user belongs to a SharePoint group and then creates an array of the groups they belong to.

Do do this I am filtering through an Array of all groups as below and then I want to check if the results from this HTTP request are blank (equal to "[]") as shown below.

 

LinkToTheAsh__0-1621512720411.png


The outputs of a (_api/web/sitegroups/GetByName('GroupName')/Users?$filter=Email eq 'EmailAddress') when the group doesn't contain this user looks like this.

 

 

{
  "d": {
    "results": []
  }
}

 

 

However Power Automate see's this "[]" parameter as an array and won't perform the check. How can I create a condition that check if these results are blank?

I've tried using double and single quotes around the square brackets, I've tried "null" as well as leaving the parameter empty but no luck.

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User II
Super User II

Hi @LinkToTheAsh_,

 

In your condition action you could check for the length of the response. If it is equal to 0 it is empty.

length(outputs('Check_if_Buyer_is_a_Member')?['body/d/results'])

 

isequalto0.png

 

View solution in original post

2 REPLIES 2
Expiscornovus
Super User II
Super User II

Hi @LinkToTheAsh_,

 

In your condition action you could check for the length of the response. If it is equal to 0 it is empty.

length(outputs('Check_if_Buyer_is_a_Member')?['body/d/results'])

 

isequalto0.png

 

View solution in original post

@Expiscornovus  that worked perfectly, so simple I feel like banging my head against the wall now haha. Thank you. 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,923)