首页 > 解决方案 > Graph API 过期订阅仍然可以从订阅列表中检索

问题描述

我想使用“GET /subscriptions”的订阅列表应该只显示活动订阅,即不包括已过期的订阅。

但是,对于其中过期订阅是订阅列表的一部分的租户之一,我遇到了问题。以下是我刚刚检索到的订阅列表,它们都已过期:

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#subscriptions",
    "value": [
        {
            "id": "45a12267-662d-4997-a5b2-...",
            "resource": "/teams/getAllMessages",
            "applicationId": "appid...",
            "changeType": "created,updated,deleted",
            "clientState": null,
            "notificationUrl": "https://url.com",
            "notificationQueryOptions": null,
            "notificationContentType": "application/json",
            "lifecycleNotificationUrl": null,
            "expirationDateTime": "2021-06-23T08:59:00.0004497Z"
        },
        {
            "id": "44cd97cc-0a17-46a7-b9c0-...",
            "resource": "/teams/getAllMessages",
            "applicationId": "appid...",
            "changeType": "created,updated,deleted",
            "clientState": null,
            "notificationUrl": "https://url.com",
            "notificationQueryOptions": null,
            "notificationContentType": "application/json",
            "lifecycleNotificationUrl": null,
            "expirationDateTime": "2021-06-23T09:59:00.0000472Z"
        },
        {
            "id": "ec91353f-6fc5-428a-9145-...",
            "resource": "/teams/getAllMessages",
            "applicationId": "appid...",
            "changeType": "created,updated,deleted",
            "clientState": null,
            "notificationUrl": "https://url.com",
            "notificationQueryOptions": null,
            "notificationContentType": "application/json",
            "lifecycleNotificationUrl": null,
            "expirationDateTime": "2021-06-23T18:58:59.9998227Z"
        },
        {
            "id": "64947372-832f-405a-99e5-...",
            "resource": "/teams/getAllMessages",
            "applicationId": "appid...",
            "changeType": "created,updated,deleted",
            "clientState": null,
            "notificationUrl": "https://url.com",
            "notificationQueryOptions": null,
            "notificationContentType": "application/json",
            "lifecycleNotificationUrl": null,
            "expirationDateTime": "2021-06-23T22:58:59.9998244Z"
        },
        {
            "id": "62c8d07f-4cc9-4d42-88a1-...",
            "resource": "/teams/getAllMessages",
            "applicationId": "appid...",
            "changeType": "created,updated,deleted",
            "clientState": null,
            "notificationUrl": "https://url.com",
            "notificationQueryOptions": null,
            "notificationContentType": "application/json",
            "lifecycleNotificationUrl": null,
            "expirationDateTime": "2021-06-23T03:59:00.0004433Z"
        },
        {
            "id": "83f06882-600d-42b0-8d20-...",
            "resource": "/teams/getAllMessages",
            "applicationId": "appid...",
            "changeType": "created,updated,deleted",
            "clientState": null,
            "notificationUrl": "https://url.com",
            "notificationQueryOptions": null,
            "notificationContentType": "application/json",
            "lifecycleNotificationUrl": null,
            "expirationDateTime": "2021-06-24T05:58:59.9995389Z"
        }
    ]
}

我无法删除或获取订阅。

DELETE /subscriptions/83f06882-600d-42b0-8d20-...
{
    "error": {
        "code": "ExtensionError",
        "message": "Operation: Delete; Exception: [Status Code: NotFound; Reason: NotFound]",
        "innerError": {
            "date": "2021-06-30T03:17:01",
            "request-id": "27496aff-5e3e-4bda-9184-a2f248cef30f",
            "client-request-id": "27496aff-5e3e-4bda-9184-a2f248cef30f"
        }
    }
}

GET /subscriptions/83f06882-600d-42b0-8d20-...
{
    "error": {
        "code": "ExtensionError",
        "message": "There was an error processing a storage extension.",
        "innerError": {
            "date": "2021-06-30T03:15:40",
            "request-id": "ba9a3046-6a93-4058-ac22-f83dbc4ceed8",
            "client-request-id": "ba9a3046-6a93-4058-ac22-f83dbc4ceed8"
        }
    }
}

How can I remove the expired subscriptions from the list of subscriptions? Thank you!

Updated code to include request-id for the GET/DELETE request.

标签: azuremicrosoft-graph-apimicrosoft-graph-teams

解决方案


推荐阅读