{"id":277,"date":"2020-02-18T09:41:11","date_gmt":"2020-02-18T09:41:11","guid":{"rendered":"http:\/\/4us2use.at\/?p=277"},"modified":"2020-02-18T09:45:47","modified_gmt":"2020-02-18T09:45:47","slug":"display-powerapp-elements-based-on-o365-group-membership","status":"publish","type":"post","link":"http:\/\/4us2use.at\/?p=277","title":{"rendered":"Display PowerApp elements based on O365 group membership"},"content":{"rendered":"\n<h3>My Szenario:<\/h3>\n\n\n\n<p>I had to build some app with confidential contents for different user groups. <br>Some contents may only be visible to a specific group of people.<\/p>\n\n\n\n<h3>Solution:<\/h3>\n\n\n\n<p>First of all I created two different security groups in O365. <br>Then I got the groupId through PowerShell (you could also use AzureAD)<br><em>Connect-MsolService<br> Get-MsolGroup | ? displayname -like\u00a0<\/em>&#8220;<em>DisplayName&#8221;<\/em><br><\/p>\n\n\n\n<p>Use the &#8220;OnStart&#8221; property of the app to load your group memberships into collections: <br><em>ClearCollect(myUsers,Office365Groups.ListGroupMembers(<\/em>&#8220;<em>groupId&#8221;).value)<\/em><\/p>\n\n\n\n<p>Now put the visible property of the element to hide to following: <br><em>If(User().Email in myUsers.mail,true,false)<\/em><\/p>\n\n\n\n<p>That&#8217;s it. It&#8217;ll check, if the current logged on user is in the collection of the group members and based on that displays content or not.<\/p>\n\n\n\n<span id=\"post-ratings-277\" class=\"post-ratings\" data-nonce=\"990b5d002d\"><img id=\"rating_277_1\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"1 Star\" title=\"1 Star\" onmouseover=\"current_rating(277, 1, '1 Star');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_277_2\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"2 Stars\" title=\"2 Stars\" onmouseover=\"current_rating(277, 2, '2 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_277_3\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"3 Stars\" title=\"3 Stars\" onmouseover=\"current_rating(277, 3, '3 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_277_4\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"4 Stars\" title=\"4 Stars\" onmouseover=\"current_rating(277, 4, '4 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/><img id=\"rating_277_5\" src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/stars\/rating_off.gif\" alt=\"5 Stars\" title=\"5 Stars\" onmouseover=\"current_rating(277, 5, '5 Stars');\" onmouseout=\"ratings_off(0, 0, 0);\" onclick=\"rate_post();\" onkeypress=\"rate_post();\" style=\"cursor: pointer; border: 0px;\" \/> (No Ratings Yet)<br \/><span class=\"post-ratings-text\" id=\"ratings_277_text\"><\/span><\/span><span id=\"post-ratings-277-loading\" class=\"post-ratings-loading\"><img src=\"http:\/\/4us2use.at\/wp-content\/plugins\/wp-postratings\/images\/loading.gif\" width=\"16\" height=\"16\" class=\"post-ratings-image\" \/>Loading...<\/span>\n","protected":false},"excerpt":{"rendered":"<p>My Szenario: I had to build some app with confidential contents for different user groups. Some contents may only be visible to a specific group of people. Solution: First of all I created two different security groups in O365. Then I got the groupId through PowerShell (you could also use AzureAD)Connect-MsolService Get-MsolGroup | ? displayname &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/4us2use.at\/?p=277\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Display PowerApp elements based on O365 group membership&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[],"_links":{"self":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts\/277"}],"collection":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=277"}],"version-history":[{"count":9,"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts\/277\/revisions"}],"predecessor-version":[{"id":286,"href":"http:\/\/4us2use.at\/index.php?rest_route=\/wp\/v2\/posts\/277\/revisions\/286"}],"wp:attachment":[{"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4us2use.at\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}