{"id":4198,"date":"2024-07-26T11:54:02","date_gmt":"2024-07-26T10:54:02","guid":{"rendered":"https:\/\/www.lieben.nu\/liebensraum\/?p=4198"},"modified":"2024-07-26T11:54:02","modified_gmt":"2024-07-26T10:54:02","slug":"populating-sharepoint-choice-column-with-entra-group-names","status":"publish","type":"post","link":"https:\/\/lieben.nu\/liebensraum\/2024\/07\/populating-sharepoint-choice-column-with-entra-group-names\/","title":{"rendered":"Populating Sharepoint Choice Column with Entra Group Names"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">If you want to allow users in Sharepoint to select e.g. security groups or teams from a dropdown in a List and don&#8217;t want to manually keep that list of choices up to date&#8230;.this is for you!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve used Power Automate Flow for this specific scenario, but Logic Apps will of course work just as well. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, define some variables and retrieve all the groups you want to show up in the Choice column:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1056\" height=\"642\" src=\"https:\/\/www.lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-5.png\" alt=\"\" class=\"wp-image-4199\" srcset=\"https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-5.png 1056w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-5-300x182.png 300w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-5-1024x623.png 1024w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-5-768x467.png 768w\" sizes=\"auto, (max-width: 1056px) 100vw, 1056px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Then, create a string with all the group&#8217;s names using a simple loop:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-6.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1070\" height=\"662\" src=\"https:\/\/www.lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-6.png\" alt=\"\" class=\"wp-image-4200\" srcset=\"https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-6.png 1070w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-6-300x186.png 300w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-6-1024x634.png 1024w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-6-768x475.png 768w\" sizes=\"auto, (max-width: 1070px) 100vw, 1070px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Then use &#8216;Send an HTTP request to Sharepoint&#8217; to retrieve current columns (fields) defined in the list if you don&#8217;t know the GUID yet. This step is optional and uses GET to the _api\/web\/Lists\/GetById(&#8221;)\/Fields method.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-9.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1055\" height=\"630\" src=\"https:\/\/www.lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-9.png\" alt=\"\" class=\"wp-image-4203\" srcset=\"https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-9.png 1055w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-9-300x179.png 300w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-9-1024x611.png 1024w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-9-768x459.png 768w\" sizes=\"auto, (max-width: 1055px) 100vw, 1055px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, use another Send an HTTP request to Sharepoint to Patch the column definition of the Choice column with the new group names.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-8.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1070\" height=\"729\" src=\"https:\/\/www.lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-8.png\" alt=\"\" class=\"wp-image-4202\" srcset=\"https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-8.png 1070w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-8-300x204.png 300w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-8-1024x698.png 1024w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2024\/07\/image-8-768x523.png 768w\" sizes=\"auto, (max-width: 1070px) 100vw, 1070px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Note we&#8217;re using PATCH for the _api\/Web\/Lists(guid&#8221;)\/Fields(guid&#8221;) method and that I&#8217;m removing the trailing comma (,) from the data we&#8217;re patching in.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also note that if you&#8217;re not using multiple choice but single choice you&#8217;ll need to adjust the SP.FieldMultiChoice and 15 values.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to allow users in Sharepoint to select e.g. security groups or teams from a dropdown in a List and don&#8217;t want to manually keep that list of choices up to date&#8230;.this is for you! I&#8217;ve used Power Automate Flow for this specific scenario, but Logic Apps will of course work just as &hellip; <a href=\"https:\/\/lieben.nu\/liebensraum\/2024\/07\/populating-sharepoint-choice-column-with-entra-group-names\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Populating Sharepoint Choice Column with Entra Group Names<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[4,13,23,32,44],"tags":[],"class_list":["post-4198","post","type-post","status-publish","format-standard","hentry","category-automation","category-entraid","category-logic-apps","category-office-365","category-sharepoint-online"],"_links":{"self":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/4198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/comments?post=4198"}],"version-history":[{"count":0,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/4198\/revisions"}],"wp:attachment":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/media?parent=4198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/categories?post=4198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/tags?post=4198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}