Getting Error Operation: Create; Exception: [Status Code: BadRequest; Reason: One of the provided arguments is not acceptable.] while trying to add webhook subscription on library in sharepoint

Manikant Jha 20 Reputation points
2023-07-05T10:28:03.1766667+00:00

POST: https://graph.microsoft.com/v1.0/subscriptions

Payload:

{
    changeType: 'updated',
    notificationUrl: webhookUrl,
    resource: `/sites/${siteId}/drives/${libraryId}/root`,
    expirationDateTime: '2023-07-10T11:59:00.0000000Z',
    clientState: 'clientState',
    latestSupportedTlsVersion: 'v1_2'
}

Response:

{
    "error": {
        "code": "ExtensionError",
        "message": "Operation: Create; Exception: [Status Code: BadRequest; Reason: One of the provided arguments is not acceptable.]",
        "innerError": {
            "date": "2023-07-05T10:14:11",
            "request-id": "f0c91e06-a0d7-4d63-ac20-f48a99b1bb32",
            "client-request-id": "b24d1531-7f7f-7bf7-f0f1-be9de0eb0631"
        }
    }
}

I am getting response on webhook and also webhook responds with properly as required.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,998 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,175 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 38,646 Reputation points Microsoft Vendor
    2023-07-06T03:02:59.5966667+00:00

    Hi @Manikant Jha,

    The error message says one of the provided arguments is not acceptable. It looks like the Subscription API doesn't support the resource of drives. Per the document, the api only support list. Please make a reference

    https://learn.microsoft.com/en-us/graph/api/subscription-update?view=graph-rest-1.0&tabs=http#permissions

    Per my test, we can create subscriptions for a list by following request

    {
        changeType: 'updated',
        notificationUrl: webhookUrl,
        resource: `/sites/{site-id}/lists/{list-id}`,
        expirationDateTime: '2023-07-10T11:59:00.0000000Z',
        clientState: 'clientState',
        latestSupportedTlsVersion: 'v1_2'
    }
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.