Fix webhook subscription creation for SharePoint Libraries (#2339)

* Fix webhook subscription creation for SharePoint Libraries
This commit is contained in:
abraunegg 2023-03-18 10:03:49 +11:00 committed by GitHub
parent 52b1276282
commit 6607ba537b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1012,10 +1012,19 @@ final class OneDriveApi
auto expirationDateTime = Clock.currTime(UTC()) + subscriptionExpirationInterval;
const(char)[] url;
url = subscriptionUrl;
// Create a resource item based on if we have a driveId
string resourceItem;
if (driveId.length) {
resourceItem = "/drives/" ~ driveId ~ "/root";
} else {
resourceItem = "/me/drive/root";
}
// create JSON request to create webhook subscription
const JSONValue request = [
"changeType": "updated",
"notificationUrl": notificationUrl,
"resource": "/me/drive/root",
"resource": resourceItem,
"expirationDateTime": expirationDateTime.toISOExtString(),
"clientState": randomUUID().toString()
];