OfficeDev/office-js

Mailbox item is undefined in compose mode (macOS Client 16.85)

Closed this issue · 9 comments

Provide required information needed to triage your issue

Office.context.mailbox.item is always (and stays always) undefined in compose mode.
My implementation works fine in both web and windows clients. So this issue only exists on macOS.

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: Mac
  • Host [Excel, Word, PowerPoint, etc.]: Outlook
  • Office version number: 16.85
  • Operating System: macOS 13
  • Browser (if using Office on the web): -

Expected behavior

Office.context.mailbox.item is exposed correctly and is not undefined in compose mode

Current behavior

Office.context.mailbox.item is undefined in compose mode

Steps to reproduce

  1. Install the add-in
  2. Compose a new email and open the add-in
  3. Log in with credentials
  4. When you add recipients in the "to" field, the logic will fail as it cannot get information from item as it's undefined. (You can enter any email address as the add-in would display a toast at the bottom if there is no corresponding data in the db)

Link to live example(s)

  1. Add-in: Download
outlook_macos_issue.mov

Provide additional details

Credentials:

This is the code that fails

const substrfromIndex = query.substring(index + modeMarker.length);
    if (substrfromIndex.startsWith("write")) {
        // runs in compose mode
        setInterval(async () => {
            Office.context.mailbox.item?.to.getAsync(async (to) => {
                    //  ..logic that fetches data
                    }, 5000)
                }
            })
        }, 1000
        )
        loading.value = false;
    } else {
       // runs in read mode
        collectEmailAddresses();
    }

Context

I'm trying to get my add-in approved for the store. And the macOS client is a requirement.

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.

We don't have the access to the add-in given, also can you please share a repro video to understand your issue better.

I have updated the issue with a new dl link and a demo video.

Hey @MarcenWare ,

Could you share an un-minified version of the code, or the exact code snippet where the Office object is being logged? Are you logging this only after Office.initialize is called, or as a callback to .onready? You can check the docs here.

@mobisw-msft

Yes, I can share the source with you. Is there a way I can get it to you directly without posting it here?

Hey @MarcenWare ,

To share the addin privately, you can create a private repository to host the add-in and then give us access to it.

@mobisw-msft

I have created this repo and gave you access.

@MarcenWare
I observe SupportsNoItemContext is added under the MessageComposeCommandSurface Extension Point, which is an unsupported scenario. As mentioned in the doc, SupportsNoItemContext child element should only be added under the MessageReadCommandSurface extension point. Please close this bug if this resolves the issue for you.

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!

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