Skip to content

‎SharePoint Updates from Word Online not accurate #10133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 of 9 tasks
Kamalasekaran opened this issue Feb 27, 2025 · 7 comments
Open
2 of 9 tasks

‎SharePoint Updates from Word Online not accurate #10133

Kamalasekaran opened this issue Feb 27, 2025 · 7 comments
Assignees
Labels
sharepoint-developer-support sharepoint-developer-support type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

Comments

@Kamalasekaran
Copy link

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.

  1. Configure it with the Sites.Selected Application permission (SharePoint) and grant admin consent.
    Create an Azure Function:
  2. Develop an Azure Function (e.g., HTTP-triggered) to handle SharePoint Webhook notifications.
  3. 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).
  4. 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).
  5. Confirm the metadata update reflects in SharePoint.
    Observe Conflict:
  6. 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.
  7. 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.

@Kamalasekaran Kamalasekaran added the type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs. label Feb 27, 2025
@ChetanSharma-msft
Copy link

Hello @Kamalasekaran - Thanks for raising your query.
We will look into it and let you know the updates.

@ChetanSharma-msft ChetanSharma-msft added the sharepoint-developer-support sharepoint-developer-support label Mar 4, 2025
@Ashlesha-MSFT Ashlesha-MSFT self-assigned this Mar 4, 2025
@Amey-MSFT
Copy link

Hello @Kamalasekaran ,
I tried to repro the steps but while trying to register the application, can you help me with the Service Tree ID?
Thanks!!!

@Kamalasekaran
Copy link
Author

@Amey-MSFT Below Steps i followed to permit Sites.selected

Created Azure AD Enterprise Application with Sites.Selected Permissions

Image

After granting Admin Permissions Run the below Powershell to Select the Specific Sharepoint Site Site

Register-PnPEntraIDAppForInteractiveLogin -ApplicationName PnPApp -Tenant contoso.onmicrosoft.com -SharePointDelegatePermissions "AllSites.FullControl" -Interactive

Get the output of the AD Application ID and Connect to the SharePoint Site

Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/test -Interactive -ClientId efb5c1ff-3b30-4d56-aad7-073ed001ec05

And the Get the AD application ID and grant the permission
Grant-PnPAzureADAppSitePermission -AppId 'be333d12-1978-4e29-8653-d6c6ca1992e0' -DisplayName 'Products (Development)' -Site 'https://contoso.sharepoint.com/sites/test' -Permissions FullControl

@Amey-MSFT
Copy link

Hello @Kamalasekaran ,
The permission you've mentioned, Sites.Selected, is used to grant access to specific SharePoint sites. However, in your PowerShell commands, you are assigning AllSites.FullControl permission, will the app might access sites that you don’t want it to?

@Kamalasekaran
Copy link
Author

@Amey-MSFT Sorry for the Miscommunication First I registered the Pnpapp with Allsites.Fullcontrol as A Delegated Permission. Using this new PnPApp I was given Sites.Selected to our AD app with Application Permissions which is mentioned in Last Command.

@Amey-MSFT
Copy link

Thank you for the clarification! That makes sense now. So, the initial AllSites.FullControl permission was applied during the registration of the PnPApp as a delegated permission, and then Sites.Selected was granted to the AD app with application permissions to limit access to specific sites. Appreciate the explanation.
Thanks!!

@Amey-MSFT
Copy link

Hello @Kamalasekaran ,
We were able to reproduce the issue, and we are investigating it. We have logged this as a bug, and our engineering team will look into it.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sharepoint-developer-support sharepoint-developer-support type:bug-suspected Suspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.
Projects
None yet
Development

No branches or pull requests

4 participants