web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Team related Security ...
Power Apps
Answered

Team related Security Roles in Canvas App

(1) ShareShare
ReportReport
Posted on by 17

I'm trying to build a canvas app to get all the security roles a User has associated to them.

 

The User -> Security Role part is working fine.

 

However when I'm trying to get the Team -> Security Role relationship into my app I get the following error.

The specified column is not accessible in this context.

 

I'm using the Following Statement First(Teams).'Security Roles'

 

Is there another way to get the information from this relationship into my canvas app?

I have the same question (0)
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @crazyguy ,

    Could you please share a bit more about your issue?

    Do you want to list all available Security Roles for a specific team?

     

    I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:

    2.JPG

     

    3.JPG

    Add two Galleries in your app, set the Items property of the first Gallery to following:

    Teams

    set the Items property of the second Gallery to following:

    Gallery1.Selected.'Security Roles'

     

    Please make sure you have configured proper Security Roles for the specific team in your Org. Please consider go to your Power Platform Admin Center, then click Environments tab, find your current Environment, then click "Settings" option, then expand the "Users + permissions" option, then click "Teams" option:

    4.JPG

     then within the opening Teams record page, switch View option to "All Owner Teams", then select specific team, then click "Manage Roles" option in Top Menus:

    5.JPG

    then check if you have assigned Security Roles for the selected team.

     

    Best regards,

  • crazyguy Profile Picture
    17 on at

    Thank you for your answer but this isn't what I want to do.

     

    I want to have a collection with all the security roles from the user.

     

    So at the start of the app. I'm getting the current user from CDS.

     

    Set( currentUser,LookUp(Users, 'Primary Email' = User().Email ));
     
    With that i'm collecting all of the users directly associated security roles via:
    Collect(securityRoles, currentUser.'Security Roles'); 
    This is no problem and working as expected.
     
    Then i'm collecting all teams a user is part of and the teams associated security roles via:
     
    With({teamids : currentUser.'Teams (teammembership_association)'.Team},With({teams:Filter(Teams, Team in teamids)},ForAll(teams, Collect(securityRoles, 'Security Roles')))
     
    And in the last part of this function it gives an error stating "The specified column is not accessible in current context".
     
    if I Select one Team using First(Teams).'Security Roles' is doesn't give that error indeed.
     
  • KSven Profile Picture
    182 on at

    Hi @crazyguy ,

     

    have you have solved this problem? Have exactly the same problem.

    Just want to find out all security roles of a specific user and all connected teams security roles..

    To work with a gallery wouldn't be a way for me as well. Just want to check all security roles at the App start.

     

    BR,

    Sven

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Same issue here, just figured out that I need to do this. Will post the solution if I found a way. Doesn't seem straightforward though.

     

    KR,

     

    Felix

  • Verified answer
    davidjfafonso Profile Picture
    on at

    @crazyguy  @Anonymous 

    This is not the prettiest solution but it will work:

     

    Set(currentUser, LookUp(Users, 'Primary Email' = User().Email));
    
    // User Roles
    ClearCollect(UserRoles, currentUser.'Security Roles (systemuserroles_association)');
    
    // User Teams
    ClearCollect(UserTeams, currentUser.'Teams (teammembership_association)');
    ClearCollect(UserTeamsAux, UserTeams);
    
    // All Roles (User + Teams)
    ClearCollect(AllUserRoles, UserRoles);
    ForAll(
     UserTeams,
     Collect(AllUserRoles, LookUp(UserTeams, 'Team Name' = First(UserTeamsAux).'Team Name').'Security Roles');
     Remove(UserTeamsAux, First(UserTeamsAux));
    )

     

    The "AllUserRoles" collection will contain all the roles (user roles + teams roles).

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Wow! Great work @davidjfafonso !! Works like a charm at first try. I'll look into what you wrote a bit later but we can definitely work with this.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,041

#2
11manish Profile Picture

11manish 676

#3
Valantis Profile Picture

Valantis 655

Last 30 days Overall leaderboard