Closed riddhi-p-28 closed 3 weeks ago
Hi @riddhi-p-28 How are you getting the itemID in local storage? Which API are you using for this?
We are using below API to get the ITEMID and storing the same in localstorage:
Office.context.mailbox.item.saveAsync((result) => { if (result.status === Office.AsyncResultStatus.Succeeded) { // store in localstorage localStorage.setItem("ITEMID", result.value); } else { console.log("Error saving item ID"); } });
We reproduce this in the following fashion:
Office.context.mailbox.item.getItemIdAsync
and note the message id returned (looks something like clientid:{{guid}}
Office.context.mailbox.item.getItemIdAsync
again and note the new message id that is returned (looks more like what we'd expect -- ex: AAMkAGRjNjgzMzFkLTk4NDAtNDNhNC1iN2IwLTRlZDlkOTc5MDA2OQBGAAAAAACBRef0LyuDT6qtuGLHHQMtBwBUwWi/zK7oTKigK60c9jLNAAAAAAEPAABUwWi/zK7oTKigK60c9jLNAAGVU4hQAAA=
)We have the following function that we call to get the id:
export const saveItem = (includeId) => new Promise((resolve, reject) => {
try {
Office.context.mailbox.item.saveAsync((saveResult) => {
if (saveResult.status !== Constants.getAsyncResultSuccessStatus()) {
console.error('Error saving mailbox item: ', saveResult.error);
reject(new Error('Error saving mailbox item'));
return;
}
if (!includeId) {
resolve(saveResult.value);
return;
}
Office.context.mailbox.item.getItemIdAsync(getItemResult => {
if (getItemResult.status !== Constants.getAsyncResultSuccessStatus()) {
console.error('Error getting id for saved mailbox item (during save): ', getItemResult.error);
reject(new Error('Error getting id for saved mailbox item'));
return;
}
resolve(getItemResult.value);
});
});
} catch (e) {
console.log('Error saving mailbox item: ', e);
reject(e);
}
});
We found that if we call this twice, with a slight delay between the calls, we end up getting back what is expected (delay we have set is 250ms).
This issue has been fixed. Thank you for raising the issue and helping us make the product better.
We are developing an outlook web addin using office js Smart alert template. We are utilizing itemID for our validation process to segregate the sessions of different mail compose windows in our web add-in. Due to the above issue, our validation results for different compose windows are getting jumbled up. We observed that item ID is being changed when we switch from one compose window to other compose window and come back. When we switch from the window the itemID is being changed to "clientId: {{GUID}}' format instead of base64 format in some cases.
Your Environment
Steps to reproduce
Expected behavior
The itemID should not be converted to 'clientId: {{GUID}}' format.
Current behavior
In step 4 the item id is shown in the format "clientId: {{GUID}}' In step 6 the item id is in Base64 format. Because of this attachments are not getting displayed in the side pane