SharePoint / SharePoint/sp-dev-docs
SharePoint Updates from Word Online not accurate
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 1.4k
- Forks
- 1.1k
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 12
Description
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint CSOM
Developer environment
Windows
What browser(s) / client(s) have you tested
- 💥 Internet Explorer
- 💥 Microsoft Edge
- 💥 Google Chrome
- 💥 FireFox
- 💥 Safari
- mobile (iOS/iPadOS)
- mobile (Android)
- not applicable
- other (enter in the "Additional environment details" area below)
Additional environment details
-Word Online
- SharePoint Online CSOM Azure function
- SharePoint Webhook
Describe the bug / error
I’m working on building a SharePoint Webhook integrated with an Azure Function that accesses a SharePoint site using an Azure Entra ID application with the Sites.Selected permission. The goal is to open a SharePoint document in Word Online, edit its content, and then use the SharePoint Webhook to trigger an Azure Function that updates the document’s metadata fields using SystemUpdate(). However, I’ve noticed an issue: if the document remains open in Word Online with AutoSave enabled, the changes made via CSOM seem to get overwritten. I’d like to understand why this is happening and how I can prevent it.
Steps to reproduce
Set Up Azure Entra ID Application:
Register an application in Azure Entra ID.
- Configure it with the Sites.Selected Application permission (SharePoint) and grant admin consent.
Create an Azure Function: - Develop an Azure Function (e.g., HTTP-triggered) to handle SharePoint Webhook notifications.
- Authenticate with SharePoint using the Azure Entra ID application using PnP command
Configure SharePoint Webhook:
Create a SharePoint document library in a SharePoint Online site.
Register a Webhook subscription for the document library, pointing to the Azure Function endpoint.
Ensure the Webhook triggers on document changes (e.g., ItemUpdated events).
Upload a Test Document:
Upload a Word document (e.g., TestDoc.docx) to the SharePoint document library.
Edit Document in Word Online:
Open TestDoc.docx in Word Online.
Enable AutoSave (default behavior in Word Online).
Make a content change (e.g., add a sentence) and let AutoSave sync the update.
Trigger Metadata Update via Azure Function:
Simulate or wait for the SharePoint Webhook to trigger the Azure Function (alternatively, manually invoke the function). - Use CSOM in the Azure Function to update metadata fields of TestDoc.docx (e.g., set a custom field like Status to Updated using SystemUpdate).
- Confirm the metadata update reflects in SharePoint.
Observe Conflict: - While TestDoc.docx remains open in Word Online with AutoSave active, note that the metadata changes made via CSOM are overwritten or reverted after a short period.
- Verify this by refreshing the SharePoint library view or checking the document properties.
Expected behavior
This Happening only with fields updated via SharePoint CSOM with SystemUpdate. If we were using the Update method getting a Version Conflict issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.