Manuel Herrera Ojea
Manuel Herrera Ojea

Reputation: 47

Outlook add-in Office object is undefined

I'm having a really hard time trying to find any documentation for Outlook add-ins development.

I want to use the Office object to access the current message attachment files from within the add-in, but Office is always undefined. I have the following block in my manifest, as it's shown on the website:

<OfficeApp
    xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
    xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0"
    xsi:type="MailApp">

And also the following line in my script before attempting to access the Office object:

<script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js" type="text/javascript"></script>

My requirements are just

<Requirements>
    <Sets>
        <Set Name="Mailbox" MinVersion="1.1" />
    </Sets>
</Requirements>

After just defining those the Office object seems to exist on the official site:

if ( Office.context.requirements.isSetSupported( RequirementSetName, VersionNumber ) ) 

What am I missing? I still get the undefined error for Office, and haven't found anything about how to make it work.

Thank you so so much in advance!

Upvotes: 0

Views: 1741

Answers (1)

Slava Ivanov
Slava Ivanov

Reputation: 6912

Per Office.js documentation ...

If you fail to include an Office.initialize event handler, your add-in may raise an error when it starts.

I believe the "Checking the load status" document will be great way to start.

Upvotes: 2

Related Questions