Divya Dev
Divya Dev

Reputation: 125

Office.context.ui.openBrowserWindow(url) not available in office.js

I am trying to use the openBrowserWindow of Office.js, but this function is not found. I am using the below line to access the office.js file.

What i am trying to achieve is, download a pdf from the outlook addin. It works well in the browser. But, when i open the addin in the outlook desktop client, the download is not working. I am using MacOS. I am yet to test it in windows. But, I really need it to work in both the browser and the client Outlook addin.

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

My manifest is as follows:

<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" xsi:type="MailApp">
  <Id>b2ce0a4d-16d2-4635-978c-f5369b4a4c22</Id>
  <AppDomains>
  </AppDomains>
  <Hosts>
    <Host Name="Mailbox"/>
    <Host Name="Outlook"/>
  </Hosts>
  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.1"/>
  <Set Name="OpenBrowserWindowApi" MinVersion="1.1"/>
      
    </Sets>
  </Requirements>

  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://localhost:3000/#/outlookAddin"/>
        <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
    </Form>
  </FormSettings>

  <Permissions>ReadWriteItem</Permissions>

  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read"/>
  </Rule>

  <DisableEntityHighlighting>false</DisableEntityHighlighting>

  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Requirements>
      <bt:Sets DefaultMinVersion="1.3">
        <bt:Set Name="Mailbox"/>
      </bt:Sets>
    </Requirements>
    <Hosts>
      <Host xsi:type="MailHost">
        <DesktopFormFactor>
          <FunctionFile resid="FunctionFile.Url"/>
         

          <ExtensionPoint xsi:type="MessageReadCommandSurface">
            <OfficeTab id="TabDefault">
              <Group id="msgReadDemoGroup">
                <Label resid="groupLabel" />
                <Control xsi:type="Button" id="selfSignFunctionButton">
                  <Label resid="selfSignButtonLabel" />
                  <Supertip>
                    <Title resid="selfSignSuperTipTitle" />
                    <Description resid="selfSignSuperTipDescription" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16x16"/>
                    <bt:Image size="32" resid="Icon.32x32"/>
                    <bt:Image size="80" resid="Icon.80x80"/>
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="Taskpane.Url"/>
                  </Action>
                </Control>
                <Control xsi:type="Button" id="rsFunctionButton">
                  <Label resid="rsButtonLabel" />
                  <Supertip>
                    <Title resid="rsSuperTipTitle" />
                    <Description resid="rsSuperTipDescription" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16x16"/>
                    <bt:Image size="32" resid="Icon.32x32"/>
                    <bt:Image size="80" resid="Icon.80x80"/>
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="Taskpane.Url"/>
                  </Action>
                </Control>
                <Control xsi:type="Menu" id="moreMenuButton">
                  <Label resid="moreButtonLabel" />
                  <Supertip>
                    <Title resid="moreSuperTipTitle" />
                    <Description resid="moreSuperTipDescription" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="Icon.16x16"/>
                    <bt:Image size="32" resid="Icon.32x32"/>
                    <bt:Image size="80" resid="Icon.80x80"/>
                  </Icon>
                  <Items>
                    <Item id="msgReadMenuItem1">
                      <Label resid="docSummaryReadLabel" />
                      <Supertip>
                        <Title resid="docSummaryReadLabel" />
                        <Description resid="docSummaryReadTip" />
                      </Supertip>
                      <Icon>
                        <bt:Image size="16" resid="Icon.16x16"/>
                    <bt:Image size="32" resid="Icon.32x32"/>
                    <bt:Image size="80" resid="Icon.80x80"/>
                      </Icon>
                     <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="Taskpane.Url"/>
                    </Action>
                    </Item>
                  </Items>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
    </Hosts>
    <Resources>
      <bt:Images>
      
      </bt:Images>
      <bt:Urls>
        <bt:Url id="FunctionFile.Url" DefaultValue="https://localhost:/index.js"/>
        <bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/#/outlookAddin"/>
      </bt:Urls>
      <bt:ShortStrings>
        </bt:ShortStrings>
      <bt:LongStrings>
          </bt:LongStrings>
    </Resources>
  </VersionOverrides>
</OfficeApp>```


I don't know how to get openbrowserwindow working.

Upvotes: 2

Views: 1195

Answers (1)

Rick Kirkham
Rick Kirkham

Reputation: 9784

Be sure you are working on a platform that supports it. See Open Browser Window API Requirement Sets.

Upvotes: 2

Related Questions