Clash Royale CLAN TAG#URR8PPP
Office Add-in: Saving Custom Document Properties with Office js in Windows
I'm developing an add-in in macOS and I am able to read a custom document property:
return await this.api.run(async (context) => {
const properties = context.document.properties.customProperties;
properties.load('key,type,value');
await context.sync();
const roomID = properties.items.find(item => item.key === 'Webex_Teams_roomID');
return roomID ? roomID.value : null;
});
and write one:
return await this.api.run(async (context) => {
context.document.properties.customProperties.add('Webex_Teams_roomID', newRoomID);
await context.sync();
});
Where this.api is just window.word using office JS API
. I used help from the following repo which is offered by Microsoft themselves, office-js-snippets.
office JS API
I'm not able to run my code in window's machine. After debugging the code, I learned that my code gets stuck at this point: await context.sync();
.
await context.sync();
Office Versions in macOS: 16.14.1 (180613)
.
16.14.1 (180613)
Office Version in Windows: 16.0.4639.1000 32-bit
16.0.4639.1000 32-bit
After some digging, I found that I don't have access to context.document.properties.customProperties.items
. It will display <permission denied>
error. Could this be it?
context.document.properties.customProperties.items
<permission denied>
And I set the Permissions
to ReadWriteDocument
:
<Permissions>ReadWriteDocument</Permissions>
Nothing....
Permissions
ReadWriteDocument
<Permissions>ReadWriteDocument</Permissions>
2 Answers
2
My best guess is that this has to do something with how async/await (not)works on IE11 and that you will have to add correct polyfill to handle this.
Async/Await
items
context.document.properties.customProperties
It turned out with this MSI build and the API that I'm using, there are some incompatibility issues that result into causing the problems that I had ealier. they suggest I move to 365.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
that's a very good point. Let me check it out. Please look at my updated post as well.
– Arash Koushkebaghi
yesterday