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

Office.context.mailbox.item.getAttachmentsAsync not returning cloud attachments #2888

Closed feannyn closed 2 months ago

feannyn commented 1 year ago

Message from office-js bot: We’re closing this issue because it has been inactive for a long time. We’re doing this to keep the issues list manageable and useful for everyone. If this issue is still relevant for you, please create a new issue. Thank you for your understanding and continued feedback.

Provide required information needed to triage your issue

On a Windows environment utilizing OWA, when attempting to attach a cloud based attachment, the cloud attachment is not added to the "attachment bar". Instead, it is added as a hyperlink within the email body.

Further, when making a call to Office.context.mailbox.item.getAttachmentsAsync, cloud attachments are not populated in the array returned, only attachments by copy; this also occurs when trying to listen to the attachmentChanged event. If the user adds a cloud attachment while our add-in is open, the event will not fire if the attachment is cloud based.

I will provide a recording of this.

Your Environment

Expected behavior

When a call to Office.context.mailbox.item.getAttachmentsAsync is made, cloud attachments should be populated in the array returned from this call

When calling the Office.EventType.AttachmentsChanged event, this should trigger when a cloud attachment is added on compose.

When a cloud attachment is added to a new message, it should appear in the attachment bar, not the email body

Current behavior

*For Office.context.mailbox.item.getAttachmentsAsync, cloud attachments are not populated in the returned array, only attachments by copy.

Steps to reproduce

  1. Open outlook on OWA and Windows Outlook on Windows 11.
  2. Compose a new message
  3. Add both cloud attachments and attachments by copy, notice the cloud attachments are appended to the email body, not the attachment bar
  4. Make a call to Office.context.mailbox.item.getAttachmentsAsync, observe the values of the returned array
  5. Make a call to Office.EventType.AttachmentsChanged with a cloud attachment, observe behavior.

Provide additional details

--

Context

Within the our add-in, we rely on these calls to display a warning message to the user that they should not attach a cloud based attachments

Further, if the user tries to send a message and ignore the warning, we prevent send, and display an error message stating there was an issue sending due to cloud attachments being present.

We render this warning on load of the add-in which relies on a call to Office.context.mailbox.item.getAttachmentsAsync. Once the add-in is loaded, we listen for changes to the attachment list, specifically whether or not there are cloud attachments present in the current message via Office.EventType.AttachmentsChanged.

Useful logs

OWA_getAttachmentsAsync_bug.mov.zip

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

exextoc commented 1 year ago

Thanks for reporting this issue regarding cloud based attachment. It has been put on our backlog. We unfortunately have no timelines to share at this point. Internal tracking id: 3107060

sys0601 commented 1 year ago

I believe that this problem was introduced in a recent update to OWA. This was working before. We would be very grateful to get some indication on when a fix is expected as it has broken code that was working previously. We need to advise our clients.

cody-lettau commented 1 year ago

Correct - this was working as expected not long ago.

AkhileshShah-MS commented 1 year ago

@exextoc Requesting you to address the queries raised by @sys0601. Also, please close this issue if we are already tracking this on our backlog, and not further customer queries. Thanks!

exextoc commented 1 year ago

Thank you for reporting this issue. This is an expected behavior with the recent update to the friendlier link names in email. Please refer to our documentation here for more details.

sys0601 commented 1 year ago

Can we please humbly request that you relook at this.

The friendlier names in the body of the email are fine. However we feel that that both Office.context.mailbox.item.getAttachmentsAsync and Office.EventType.AttachmentsChanged should recognize that a file has been attached (when they are linked from one drive). Otherwise those two functions/events become incomplete.

Alternatively can you provide another way of detecting that a file has been linked?

Thank you for your help.

exextoc commented 1 year ago

Currently links are not supported to be returned from the getAttachmentsAsync api. 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” https://[aka.ms/M365dev-suggestions](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Faka.ms%2FM365dev-suggestions&data=04%7C01%7CDaniele.Bercovici%40microsoft.com%7C82496bc384404255bc6808d8fe1fde30%7C72f988bf86f141af91ab2d7cd011db47%7C0%7C0%7C637538760227690968%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9visic2Ti%2FATFoVGDNcvO86URULWWtAvqsNRK%2BH37G8%3D&reserved=0)

cody-lettau commented 1 year ago

@exextoc I'm unsure how this is a feature request and not a bug. Prior to the change to add links to the email body, this was working as expected where the cloud attachments were returned in the calls to get all attachments, as well as triggered the attachment change event.

With this functionality broke, there is no way for add-ins to remove all attachments or do anything with those cloud attachments. This is a step backward in functionality since this change to using links.

cody-lettau commented 1 year ago

@sys0601 I opened https://techcommunity.microsoft.com/t5/microsoft-365-developer-platform/outlook-officejs-attachment-calls-support-for-cloud-attachment/idi-p/3689994#M1506

sys0601 commented 1 year ago

@exextoc I have to agree with @cody-lettau on this one. This was working for us in the past as well. We need to have a way of identifying cloud attachments.

@exextoc I'm unsure how this is a feature request and not a bug. Prior to the change to add links to the email body, this was working as expected where the cloud attachments were returned in the calls to get all attachments, as well as triggered the attachment change event.

With this functionality broke, there is no way for add-ins to remove all attachments or do anything with those cloud attachments. This is a step backward in functionality since this change to using links.