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

Can someone help me figure out why CheckMemberGroupsV2 is failing?

Hi there,

 

I created an app which is linked to a google sheets data source. The data source contains a list of emails. I want to check if these emails are in an Azure AD group and if they are not then I want the record associated with the email to be removed from the google sheets data source.

So far, I have the line below:

RemoveIf(Sheet1, IsEmpty(AzureAD.CheckMemberGroupsV2(email,["48ce8a71-7762-46e0-9eea-4f26059d21fa"]).value))

 

However, I am getting the error message:
"Resource 'testing' does not exist or one of its queried reference-property objects are not present."

 

The google sheets database currently only has two emails in it. One email is an email that is the Azure AD (therefore it's record shouldn't be deleted) whereas the other email is called "testing" and this email isn't in the Azure AD therefore the record should be deleted.

 

Could someone explain to me why CheckMemberGroupsV2 is failing? From the documentation I read it seems it should return an empty result if the email isn't in the google sheets database instead of failing.

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @Xpholio ,

 

So wired, as that formula work perfectly on my side.

Another alternative workaround, try to use GetGroupMembers function to obtain all members in group and use Condition to check whether sheet1 emails are in the group.

ClearCollect(colGroupUsers,AzureAD.GetGroupMembers("a901f3f1-ad65-4007-a324-034f24112470").value);
ForAll(RenameColumns(Sheet1,"email","em"),If(Not(em in colGroupUsers.mail),RemoveIf(Sheet1,email=em)))

 Hope this helps.

Sik

View solution in original post

6 REPLIES 6
v-siky-msft
Community Support
Community Support

Hi @Xpholio ,

 

Could you please try to modify the code as follows to see if it works?

RemoveIf(Sheet1, EmailColumn=If(IsEmpty(AzureAD.CheckMemberGroupsV2(email,["48ce8a71-7762-46e0-9eea-4f26059d21fa"]).value),email))

 

Hope this helps.

Sik

Hi, I tried modifying the code to the code you provided but I am still getting the same error (the only thing different about my code compared to your code is I changed EmailColumn to email since email is the name of the EmailColumn). I then tried adding a false condition as well ("") to see if that would change anything but it didn't.

 

I have included a screenshot of the error below and a screenshot of my database.

Screenshot (6).png

database.PNG

v-siky-msft
Community Support
Community Support

Hi @Xpholio ,

 

OK, I got it. The first error message is from API server that if the email is not contained in the group, this error shows.

We can use IfError() function to detect this error, so please try to modify the Remove formula as follows.

ForAll(Sheet1.em As V,IfError(AzureAD.CheckMemberGroupsV2(V.em,["48ce8a71-7762-46e0-9eea-4f26059d21fa"]).value,RemoveIf(Sheet1,em=V.em)))

 

The second error message shown in the screenshot4 seems to be a conflict error for google sheet in ForAll loop. 

Could you confirm that the required fields for the sheet are being patched please?

 

Sik

Unfortunately after modifying the remove formula to the formula you provided I still am getting that 2nd error so the fields aren't being patched. Screenshot (8).png

v-siky-msft
Community Support
Community Support

Hi @Xpholio ,

 

So wired, as that formula work perfectly on my side.

Another alternative workaround, try to use GetGroupMembers function to obtain all members in group and use Condition to check whether sheet1 emails are in the group.

ClearCollect(colGroupUsers,AzureAD.GetGroupMembers("a901f3f1-ad65-4007-a324-034f24112470").value);
ForAll(RenameColumns(Sheet1,"email","em"),If(Not(em in colGroupUsers.mail),RemoveIf(Sheet1,email=em)))

 Hope this helps.

Sik

View solution in original post

Great thank you, this solution worked.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

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

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (95,786)