我正在尝试为共享点列表创建一个网络挂钩。不幸的是,这样做的唯一方法是调用 API。所以我调用了 API 来创建我自己的 web 挂钩到我的共享点站点中的自定义列表。
在我的 sharepoint 站点中,我在 Chrome 中打开了开发工具,并使用了以下代码:
fetch("https://my-org.sharepoint.com/sites/my-site/_api/web/lists('list-id')/subscriptions", {
"headers": {
"accept": "application/json",
"content-type": "application/json",
},
"body": "{\"resource\":\"https://my-org.sharepoint.com/sites/my-site/_api/web/lists('list-id')\",\"notificationUrl\":\"http://my-ngrok-id.ngrok.io\",\"expirationDateTime\":\"2021-11-03T21:54:41.000\"}",
"method": "POST",
});
但它给出了一个403
错误:
{
"odata.error": {
"code": "-2130575251, Microsoft.SharePoint.SPException",
"message": {
"lang": "en-US",
"value": "The security validation for this page is invalid and might be corrupted. Please use your web browser's Back button to try your operation again."
}
}
}