I am new to sharepoint and now I am trying to create a webhook for my sharepoint sites, such that on any crud operation i would get notification in my app
I have created a webapp to receive notification and console application to subscribe notification, I used Microsoft graph api by referring this document to create subscription
Now the issue is when i give following in my subscription request body
Resource = "sites/{siteName}/lists/{listId}" It does hit in my notification web app from where i respond 200 ok, but then in my console web application it throws error saying "Invalid hostname for this tenancy"
I am not sure about my resource id, is there any suggestion for my SharePoint site resource
51 Answer
Generally you would get this error when your hostname is wrong. For ex: here is the valid way of getting a site
var site = await graphClient.Sites.GetByPath("/sites/{siteName}","{companyName}.sharepoint.com"); We should not add https:// in the hostname.