Microsoft Security | Microsoft Graph
An API that connects multiple Microsoft services, enabling data access and automation across platforms
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I'd like to get notified when there is a sharing change on drive items (Business SharePoint/OneDrive). To do that, I created a subscription with the prefer:includesecuritywebhooks option as mentioned here. The below code doesn't help me. Could you please guide me on that?
async def create_subscription():
expiration_date_time: datetime = datetime.now(tz=tz.UTC) + timedelta(minutes=42300)
request_body = Subscription(
change_type="updated",
notification_url="{WEBHOOK_URL}",
resource="/drives/{DRIVE_ID}}/root",
expiration_date_time=expiration_date_time,
client_state="secretClientValue",
)
headers_collection = HeadersCollection()
headers_collection.add("prefer", "includesecuritywebhooks")
request_configuration = RequestConfiguration(headers=headers_collection)
return await client.subscriptions.post(
request_body, request_configuration=request_configuration
)
Thanks,
Yusuf Ugur
An API that connects multiple Microsoft services, enabling data access and automation across platforms