Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Office.context.mailbox.item.sessionData.setAsync is undefined #4169

Closed
barclayadam opened this issue Feb 23, 2024 · 2 comments
Closed

Office.context.mailbox.item.sessionData.setAsync is undefined #4169

barclayadam opened this issue Feb 23, 2024 · 2 comments
Assignees
Labels
Area: Outlook Issue related to Outlook add-ins

Comments

@barclayadam
Copy link

Provide required information needed to triage your issue

Office.context.mailbox.item.sessionData.setAsync is undefined on supported Outlook versions

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: PC
  • Host [Excel, Word, PowerPoint, etc.]: Office
  • Office version number: 16.0.17328.20108 / 16.0.17231.20236
  • Operating System: Windows

Expected behavior

Office.context.mailbox.item.sessionData.setAsync to exist and work. We use sessionData but have a fallback in case it is not available. We have various checks in place to make sure it works, because we cannot rely on the requirement set checking (proven by this bug again, which would have manifested if we were only checking the requirement set):

function sessionDataSupported() {
    const ctx = context();
    const diags = diagnostics();

    if (ctx.mailbox.item.sessionData == undefined) {
        return false;
    }

    if (isMobile()) {
        // Although sessionData property exists, trying to save will result in Sys.FeatureNotEnabled error
        return false;
    }

    // Based on comment at https://github.com/OfficeDev/office-js/issues/2300#issuecomment-1028878708 SessionData is only properly supported on
    // PC when the version is > 16.0.14701.20290

    // Only check version number on Windows platform
    if (diags.platform !== Office.PlatformType.PC) {
        return true;
    }

    const versionAsNumber = parseInt(diags.version.replace(/\./g, ''));

    return versionAsNumber >= 1601470120290;
}

Current behavior

"sessionData.setAsync is not a function" error is thrown

As a workaround to this issue I've added an additional check, as below:

    if (ctx.mailbox.item.sessionData.setAsync == undefined) {
        return false;
    }

From the first snippet you can also see I've had to do an explicit check for mobile, because sessionData as an object exists, but using any methods just throws. This object is generally problematic and not well defined.

Steps to reproduce

  1. Attempt to use sessionData.setAsync on an affected Outlook installation

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.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Feb 23, 2024
@exextoc exextoc added Needs: attention 👋 Waiting on Microsoft to provide feedback Area: Outlook Issue related to Outlook add-ins and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Feb 23, 2024
@exextoc exextoc self-assigned this Feb 23, 2024
@manuelsidler
Copy link

@barclayadam the issue is already addressed #4154

@zhngx1
Copy link

zhngx1 commented Feb 27, 2024

Thanks for reporting this, it is a duplicate of #4154

@zhngx1 zhngx1 closed this as completed Feb 27, 2024
@zhngx1 zhngx1 removed the Needs: attention 👋 Waiting on Microsoft to provide feedback label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Outlook Issue related to Outlook add-ins
Projects
None yet
Development

No branches or pull requests

4 participants