cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LukePWilkins
Helper II
Helper II

(sorry) Trivial Post! - Need this array value as a string

I call a http request to GraphAPI and return a list of the security groups a user is a member off. I only need to select the group type and the group ID. 

The output is this:

{
"body": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects(groupTypes,id)",
"value": [
{
"@odata.type": "#microsoft.graph.group",
"groupTypes": [
"DynamicMembership"
],
"id": "badc0e9e-d736-4534-b2c2-7aed3280a035"
},
{
"@odata.type": "#microsoft.graph.group",
"groupTypes": [
"Unified"
],
"id": "14a7c19e-db29-4e5c-82ec-657686b5f27d"
},
{
"@odata.type": "#microsoft.graph.group",
"groupTypes": [
"Unified"
],
"id": "1b8d728a-bf51-4ddd-b167-9e945f734d77"
}
]
}
}

 

If I PARSE the output on body, I can return the ID as a string in a compose activity. What throws me is groupTypes returns in a single array 

[

"DynamicMembership"

]

 

How do I go about retrieving the string DynamicMembership please?

 

 

4 REPLIES 4
Rhiassuring
Community Champion
Community Champion

Nothing is ever trivial when it comes to flow...

 

So you're only asking how to get the string out of that last thing you posted?

 

variables('arrGroup')[0]
 
(Where variables('arrGroup') is whatever is holding your single item there.) 

The [0] just says "take the thing that's at an index of 0 in this array."
 
You could also use first(variables('arrGroup'))
 
Whatever floats your boat.
LukePWilkins
Helper II
Helper II

Thank you! 

Your reply pointed me in the right direction and I sorted it..

regards

LukePWilkins
Helper II
Helper II

Still doesn't work 100%, only the first ([0]) is being returned. 

Maybe I'll expand the question and ask, how do I parse the following to get the ID and the GroupType only. 

 

{
    "body": {
        "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects(groupTypes,id)",
        "value": [
            {
                "@odata.type": "#microsoft.graph.group",
                "groupTypes": [
                    "DynamicMembership"
                ],
                "id": "badc0e9e-d736-4534-b2c2-7aed3280a035"
            },
            {
                "@odata.type": "#microsoft.graph.group",
                "groupTypes": [
                    "Unified"
                ],
                "id": "14a7c19e-db29-4e5c-82ec-657686b5f27d"
            },
            {
                "@odata.type": "#microsoft.graph.group",
                "groupTypes": [
                    "Unified"
                ],
                "id": "1b8d728a-bf51-4ddd-b167-9e945f734d77"
            }
        ]
    }
}

 

VictorIvanidze
Community Champion
Community Champion

Use Select action.

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (2,010)