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
657 stars 93 forks source link

[OnSend Addin] Sample code of Updateitem which updates sensitivity label using makeEwsRequestAsync API is not working #1673

Closed Premsagar-lab closed 3 years ago

Premsagar-lab commented 3 years ago

I tried the sample code from my onsend outlook addin to update the sensitivity of the email from the given sample from the document at below link: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/updateitem-operation

Expected Behavior

Sensitivity label should be changed.

Current Behavior

I receive error name "GenericResponseError" and code: "9020". description: "The request is invalid."

Steps to Reproduce, or Live Example

My Sample Code using documentation: UpdateItemCode.txt

Your Environment

exextoc commented 3 years ago

Just to clarify what platform are you on? Mac Rich Client (what build?), or the Browser version of Outlook (Outlook Web Access) on Safari on a Mac?

Premsagar-lab commented 3 years ago

@exextoc I have tried with Microsoft Outlook for mac version 16.43 and also on OWA in safari version 14.0.1.

exextoc commented 3 years ago

I am forwarding this issue internally to our Mac/OWA teams, however it is likely that setting the sensitivity via EWS during OnSend event, is not reliable. (since EWS the server, and OnSend is happening on the client) A sensitivity office-js api will be needed to really do this properly.

Suggestions for future APIs can be made at User Voice: https://officespdev.uservoice.com/forums/224641-general/category/131778-outlook-add-ins

Premsagar-lab commented 3 years ago

@exextoc, Does UpdateItem request works with Onsend addin? If yes, Can you share any sample updateitem soap request which works with onsend addin? Basically I want to set the MIP Label if UpdateItem works successfully.

exextoc commented 3 years ago

Edited: Can you share the api you are using to get itemId? The itemId before sending an email is temporary and it gets changed after the mail is sent.

Premsagar-lab commented 3 years ago

@exextoc Yes, we are getting a valid EWS id before sending a mail.

We are doing the following:

  1. We are saving the email being composed.
  2. Then we call "Office.context.mailbox.item.getItemIdAsync" to get the Item ID on the saved email.
  3. Using this ItemID, we retrieve the ChangeKey of the email using GetItem request of Office.context.mailbox.makeEwsRequestAsync API.
  4. This ItemID and ChangeKey is then passed to UpdateItem request.

Are we missing anything here?

Premsagar-lab commented 3 years ago

@exextoc Any updates on this?

exextoc commented 3 years ago

Hey @Premsagar-lab ,

Apologies for the delay. I am able to reproduce this issue across clients. It seems like the UpdateItem call is not working even from a Taskpane add-in. We are investigating this issue to see if this scenario is supported and if there are any workarounds for it.

exextoc commented 3 years ago

Currently the feature: Updating the sensitivity label using makeEwsRequestAsync, you requested, is not a part of the product. We track Outlook add-in feature requests on our Tech Community Page. Please submit your request there and choose the appropriate label(s). Feature requests on Tech Community are considered, when we go through our planning process.

Github Label: “Type: product feature request” aka.ms/M365dev-suggestions

[Outlook Add-ins Engineering Team]

ghost commented 3 years 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!

ghost commented 3 years ago

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