Error 'Invalid hostname for this tenancy' on using graph api of sharepoint to subscribe event notification

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

5

1 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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like