Does Sharepoint webhooks work with Python web application?

Banerjee, Somali 0 Reputation points
2023-08-16T09:09:17.59+00:00

Hi All,

I am trying to receive real time notifications for changes in sharepoint lists. Is it possible to connect the webhook with Python backend application?

Microsoft 365 and Office SharePoint Development
Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2023-08-17T03:02:38.19+00:00

    Hi @Banerjee, Somali,

    Per my research, you could Granting access using SharePoint App-Only to connect with sharepoint. You can access sharepoint by accesstoken and call HTTP requests by following code

    headers = {
        'Authorization': "Bearer " + json_data['access_token'],
        'Accept':'application/json',
        'Content-Type': 'application/json'
    }
    
    url = "https://tenant.sharepoint.com/sites/TestSite/_api/web/lists('list-guid')/subscriptions"
    l = requests.post(url, headers=headers, data=data)
    

    Here is a nice article to call http request for you to reference

    https://martinnoah.com/sharepoint-rest-api-with-python.html


    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.