Search code examples
azureazure-devopsazure-api-apps

Need to get last activity date or some date to show inactive projects in azuredevops


I am trying to go through all of our projects in Azure DevOps to determine projects that haven't had any activity (builds, releases, commits, changes, what have you) along with their project leads within a given amount of time, say last year. I have yet not found a clear concise way to gather this information from our Azure DevOps organization, so I am here reaching out for some assistance.

Basically we are doing housekeeping activities to clean up the organization.

Thanks in advance.


Solution

  • You could use GET project API to check the "lastUpdateTime" of each projects.

    https://learn.microsoft.com/en-us/rest/api/azure/devops/core/Projects/List?view=azure-devops-rest-7.1&tabs=HTTP

    GET https://dev.azure.com/{organization}/_apis/projects?api-version=7.1-preview.4

    Check the response body ("lastUpdateTime")

    {
        "count": 13,
        "value": [
            {
                "id": "",
                "name": "Kim Test Project",
                "description": "",
                "url": "",
                "state": "wellFormed",
                "revision": 149,
                "visibility": "private",
                "lastUpdateTime": "2022-06-14T03:06:44.777Z"
            },
            {
                "id": "",
                "name": "",
                "url": "",
                "state": "wellFormed",
                "revision": 177,
                "visibility": "private",
                "lastUpdateTime": "2022-08-09T01:32:47.34Z"