none
SharePoint List Webhook fails to validate when using Azure Function endpoint after webhooks GA

    Question

  • I have an Azure Function that should responds to a SharePoint webhook that I can't get to validate.

    1: Is a screen shot of my function with a test showing that it is returning a validation token when one is passed

    2: See here a postman trace showing that it fails to validate. There are no log entries in the Azure Function. I have validated that the function code is the default code and I can run function from post man 3: is proof that the function returns a validationToken when passed

    4: is the webhook working when the service URL is an anonymous webapi method

    What am I missing? I had this working on a developer tenant a week ago and now after GA I can't get it to work anywhere. 

    1:

    2:


    3:

    4:

    Friday, January 27, 2017 10:31 PM

All replies

  • Hi,

    To access SharePoint list using REST API in remote side, please follow the steps below:

    • Get the security token
    • Get the access token
    • Get the request digest

    http://paulryan.com.au/2014/spo-remote-authentication-rest/

    In this case, if you want to Web Hooks in your SharePoint list, the following article with source code for your reference:

    https://github.com/SharePoint/sp-dev-samples/tree/master/Samples/WebHooks.List

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, January 31, 2017 8:43 AM
    Moderator
  • Dennis,

    Thanks for your response. My issue is not security related as you can see in screen shot #4 I am able to subscribe a webhook when the endpoint is an anonymous webapi endpoint on an azure website. I take that same request and change only the notificationUrl to my azure function and it fails with unable to validate endpoint. However from the logs I can find it has never called the endpoint. Are there logs in the Azure function that let me see failed requests? All the logs I can see from azure functions do not show the failed request which leads me to believe that something is being blocked. Also the C# code I am using to register the webhook in my application is from the code sample you link to. This worked two weeks ago.

    Tuesday, January 31, 2017 2:47 PM
  • Hi,

    Please try to redeploy the solution and check whether the issue still exists or not.

    Best Regards,

    Dennis


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, February 1, 2017 8:30 AM
    Moderator
  • Hi, Did you managed to get solution to this issue. I am getting exactly same problem. Regards Amit
    Friday, September 1, 2017 12:05 AM
  • Hey

    I had the same issue recently. I had a web api which I just couldn't validate as the endpoint for my webhook. After some research I found out that the response probably just took to long and I changed my code with the following code. After that it worked perfectly.

    I hope it helps for you as well

    [HttpPost]
    public async Task<HttpResponseMessage> Post(string validationToken = null)
    {  
    	if (validationToken != null)
    	{
    		var response = Request.CreateResponse(HttpStatusCode.OK);
    		response.Content = new StringContent(validationToken);
    		return response;
    	}
    
    	return new HttpResponseMessage(HttpStatusCode.OK);
    }

    Friday, November 17, 2017 1:44 PM
  • I'm having the same problem. I have Web API on our local IIS which is open to publich network with HTTPS and Certificate. I can connect using Postman and Browser but when I try to attach the webhook I get Failed to validate the notification URL

    I googled all day withouth any luck.

    Tuesday, April 24, 2018 1:57 PM