OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
648 stars 92 forks source link

AutoSave is not triggered when only custom properties is added and nothing else has changed in document - Word add in #4320

Closed ManoharRTTR closed 2 weeks ago

ManoharRTTR commented 2 months ago

When we tried to add a custom property through officeapi on a word addin by turning on AutoSave option. autosave is not initiated when a new custom property added and nothing else is changed in the document.

Your Environment

Expected behavior

AutoSaved is initiated and document is saved with the custom property added.

Current behavior

AutoSaved is not initiated and document is not saved with the custom property added.

Steps to reproduce

Word.run(async (context) => { context.document.properties.customProperties.add(key, value) return context .sync() .then(() => { console.log('Property saved') }) .catch((e) => { console.log(Error occured inserting property ${e.message}) }) })

microsoft-github-policy-service[bot] commented 2 months ago

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

xuruiyao-msft commented 1 month ago

@ManoharRTTR I cannot reproduce the issue on my local environment. I executed the code snippet after the autosave button is toggled. Then I close the document and reopen it again. The custom properties are saved successfully. I can get the custom properties : `async function getCustomProperties() { Word.run(async (context) => { const customProperties = context.document.properties.customProperties; customProperties.load(); await context.sync();

for (let i = 0; i < customProperties.items.length; i++) {
  console.log(`${i}: ${customProperties.items[i].key}: ${customProperties.items[i].value}`);
}

}); }` Did I miss some key information to reproduce the issue? What's the behavior from your side observing that AutoSaved is not initiated and document is not saved with the custom property added? How did you set the AutoSave option? If you can provide more detailed steps that would be helpful to relocate the root cause. Thanks again for reaching out to us.

microsoft-github-policy-service[bot] commented 2 weeks ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

microsoft-github-policy-service[bot] commented 2 weeks ago

This issue has been closed due to inactivity. Please comment if you still need assistance and we'll re-open the issue.