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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Azure devops team capa...
Power Automate
Unanswered

Azure devops team capacity not loading correctly in excel

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I'm trying to fetch team capacity from azure devops. When I'm trying to load the start and end date (daysoff) it does not load al the data in. Its only loading the members with days off. Not every member in my organisation has days off as a result that there is no start and end entity. I have the following json parse: 

{
    "type""object",
    "properties": {
        "teamMembers": {
            "type""array",
            "items": {
                "type""object",
                "properties": {
                    "teamMember": {
                        "type""object",
                        "properties": {
                            "displayName": {
                                "type""string"
                            },
                            "url": {
                                "type""string"
                            },
                            "_links": {
                                "type""object",
                                "properties": {
                                    "avatar": {
                                        "type""object",
                                        "properties": {
                                            "href": {
                                                "type""string"
                                            }
                                        },
                                        "required": [
                                            "href"
                                        ]
                                    }
                                },
                                "required": [
                                    "avatar"
                                ]
                            },
                            "id": {
                                "type""string"
                            },
                            "uniqueName": {
                                "type""string"
                            },
                            "imageUrl": {
                                "type""string"
                            },
                            "descriptor": {
                                "type""string"
                            }
                        },
                        "required": [
                            "displayName",
                            "url",
                            "_links",
                            "id",
                            "uniqueName",
                            "imageUrl",
                            "descriptor"
                        ]
                    },
                    "activities": {
                        "type""array",
                        "items": {
                            "type""object",
                            "properties": {
                                "capacityPerDay": {
                                    "type""number"
                                },
                                "name": {
                                    "type""string"
                                }
                            },
                            "required": [
                                "capacityPerDay",
                                "name"
                            ]
                        }
                    },
                    "daysOff": {
                        "type""array",
                        "items": {
                            "type""object",
                            "properties": {
                                "start": {
                                    "type""string",
                                    "Default""null"
                                },
                                "end": {
                                    "type""string",
                                    "Default""null"
                                }
                            },
                            "required": [
                                "start",
                                "end"
                            ]
                        }
                    },
                    "url": {
                        "type""string"
                    }
                },
                "required": [
                    "teamMember",
                    "activities",
                    "daysOff",
                    "url"
                ]
            }
        },
        "totalCapacityPerDay": {
            "type""number"
        },
        "totalDaysOff": {
            "type""number"
        }
    },
    "required": [
        "teamMembers",
        "totalCapacityPerDay",
        "totalDaysOff"
    ]
}
Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Anonymous,

     

    What is the structure of your Excel? Do you want to add a separate row for each activity value and also for each day off per team member? Or do you want to combine the activities and the days off into one row in the excel per TeamMember?

     

    In your current setup you are looping through the daysOff items via the nested apply to each 4 action. And if that daysOff array is empty it will simply skip the Add new row in that apply to each.

     

    So, it makes sense that teamMembers who don't have a dayOff will be skipped.

     

     

  • Community Power Platform Member Profile Picture
    on at

    Hi,

    I would like to combine the activities and days off into one row. When I select the activities and days off in the add row action, it automatically applies the for each.

     

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Anonymous,

     

    A bit of a delayed response. But managed to create a flow which can select both the activities and days off into one row, which prevents it going into a nested loop. I have used xml, xpath and join functions for this.

     

    Below is an example

     

    1. Send an HTTP request to Azure DevOps, which used the URI

    https://learn.microsoft.com/en-us/rest/api/azure/devops/work/capacities/get-capacities-with-identity-ref-and-totals?view=azure-devops-rest-7.2

     

     

    @{variables('Project')}/_apis/work/teamsettings/iterations/@{variables('IterationId')}/capacities?api-version=7.2-preview.3

     

     

    2. Filter Array From

     

    outputs('Send_an_HTTP_request_to_Azure_DevOps')?['body']['teamMembers']

     

     

    3. Filter Array Criteria

     

    @greater(length(item()['daysOff']), 0)

     

     

     

    4. Compose action which is used to convert the json into XML (makes it easier to retrieve fields from nested arrays).

     

    xml(json(concat('{"root": { value:', body('Filter_Array'), '}}')))

     

     

     

    5. Select From

     

    xpath(outputs('XML'), '//root/value')

     

     

     

    6. Select Map (switched to text mode with button on the right side)

     

    {
     "Name": @{xpath(item(), 'string(//teamMember/displayName/text())')},
     "Days Off": @{join(xpath(item(), '//daysOff/start/text()'), ', ')},
     "Activity Name": @{join(xpath(item(), '//activities/name/text()'), ', ')},
     "Activity Capacity per Day": @{join(xpath(item(), '//activities/capacityPerDay/text()'), ', ')}
    }

     

     

     

    daysoff_ado.png

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard