cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Oskarkuus
Post Prodigy
Post Prodigy

Permission control not working, cant see what i am doing wrong

I have this code on my ONSTART

screenshot: http://prntscr.com/nok0al

ClearCollect(collAppUsers5;'Office365-grupper'.ListGroupMembers("7b606cec-bb50-438a-a262-89269ca0eb73").value);;Set(Button1Mode;CountRows(Filter(collAppUsers5;Lower(mail) =Lower( User().Email))) = 1);;

ClearCollect(collAppUsers6;'Office365-grupper'.ListGroupMembers("2ec581ed-429b-4e8e-878a-6ce10ff32b58").value);;Set(Button2Mode;CountRows(Filter(collAppUsers6;Lower(mail) =Lower( User().Email))) = 1);;

ClearCollect(collAppUsers7;'Office365-grupper'.ListGroupMembers("1749g410-e704-45f4-8507-36g6b00e68a9").value);;Set(Button3Mode;CountRows(Filter(collAppUsers7;Lower(mail) =Lower( User().Email))) = 1)

Then i have this on DisplayMode for a button.

If(Button1Mode;DisplayMode.Edit;DisplayMode.Disabled)

If(Button2Mode;DisplayMode.Edit;DisplayMode.Disabled)

If(Button3Mode;DisplayMode.Edit;DisplayMode.Disabled)

Ofc just one line per button, so in total i have 3 buttons.

 

Button1 and Button3 works fine.

My account is member of the gorup with the above ID for Button2.

But still the DisplayMode does not change.

It do change for all other buttons... but not this one. I have tried leaving the group and rejoining.. Still nothing.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Oskarkuus 

First...there is data in it...that's a good thing.

Now, if you're looking at the View->Collections area, then yes, it is limited to 5.  I sent you there as a quick check to make sure that you are actually gathering daa in the collection...which you are.

 

So, now, I would do that next piece from before - create a Gallery and set the Items to the collection.  Then throw a label in the Gallery and set the Text to ThisItem.mail

See if you see yourself in there - or at least you see things you expect.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

10 REPLIES 10
RandyHayes
Super User III
Super User III

@Oskarkuus 

Put a Label on the screen and set the Text property to:   

CountRows(Filter(collAppUsers6;Lower(mail) =Lower(User().Email)))

See what that displays.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

i get zero (0) as a result.

 

That seems wrong.

Why?

EDIT:
I did the same for all others, added a label and all other show 1. This one show 0

 

@Oskarkuus 

Yes, that would be a problem if you are in that group as you suspect.

The next thing would be to look at the collection (collAppUsers6) in the View->Collections area and see that you are getting results from that formula in the collection.

If it is empty, then I suspect there is an issue with the GroupID.

If it has values and you are not in it, then I suspect either a lag in the group members list being updated on the Office 365 side or some other factor.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

I created a gallery and put this in the gallerys ITEMS

'Office365-grupper'.ListOwnedGroups()

 

I get no results atall.

In the gallery i have one textfield with this:

ThisItem.ID

 

This used to work before, but now i get error that ID is not valid.

So i cant even get a list of my accounts groups.

 

Also tried this in the gallery items
'Office365-grupper'.ListGroupMembers("GROUP-ID-NUMBER")

Same issue as above, no reults and ID is not valid o.O

 

Could this be Microsoft doing something?

 

Logged in with one other account.

 

One account all but 1 buttns work.

One account none of the buttons work.

 

Both accounts have the same group memberships and should see exactly the same.

 

Something is not right.

@Oskarkuus 

The ListOwnedGroups function will return a table that has a Value column.  In that Value column is the table of all the groups.

So, change your Gallery Items to the following formula:

'Office365-grupper'.ListOwnedGroups().value

Now you will have all of the group rows in the Gallery and ThisItem.id will be valid.

 

The same goes for your ListGroupMembers function.  It will return a table with a value column.  The first record value column is what you want.

 

You can test all of this with two galleries (Gallery1 and Gallery2)

Items for Gallery1 - 'Office365-grupper'.ListOwnedGroups().value

A label in the Gallery.  Set text to : ThisItem.id

 

Items for Gallery2 - 'Office365-grupper'.ListGroupMembers(Gallery1.Selected.id).value

A Label in Gallery2.  Set test to : ThisItem.displayName

 

You will now see all groups you own and all members in those groups as you select them.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

@Oskarkuus 

So the question still remains I asked earlier, what are you getting in those collections?

If you don't view them through the collection viewer, then at least set them as the items property of a gallery and see what is going on in them.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

I only see 5 rows of members/data in my collection.

The group have over 30 members....

 

So it seems i only get 5 ?!

@Oskarkuus 

First...there is data in it...that's a good thing.

Now, if you're looking at the View->Collections area, then yes, it is limited to 5.  I sent you there as a quick check to make sure that you are actually gathering daa in the collection...which you are.

 

So, now, I would do that next piece from before - create a Gallery and set the Items to the collection.  Then throw a label in the Gallery and set the Text to ThisItem.mail

See if you see yourself in there - or at least you see things you expect.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (21,161)