0

I have an outlook web-add which performs the action of moving mail to another folder using the GRAPH API. I want to do display a message when the action is done (when the server' response is received) either directly in the taskpanel or in an popup using Office.context.ui.displayDialogAsync().

However, when the email is moved by the graph API and the changed are "synced" on the Outlook client, the taskpanel and the dialog close as the email no longer exists (the email moved is considered as another item).

IS there a way to detach the dialog from the parent (the taskpane), or to keep the taskane open?

Here is the manifest used:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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">
  <Id>[REDACTED]</Id>
  <Version>1.0.0.1</Version>
  <ProviderName>[REDACTED]</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="[REDACTED]"/>
  <Description DefaultValue="[REDACTED]"/>
  <IconUrl DefaultValue="https://localhost:3000/assets/icon64.png"/>
  <HighResolutionIconUrl DefaultValue="https://localhost:3000/assets/icon128.png"/>
  <SupportUrl DefaultValue="[REDACTED]"/>
  <AppDomains>
    <AppDomain>https://localhost:3000</AppDomain>
  </AppDomains>
  <Hosts>
    <Host Name="Mailbox"/>
  </Hosts>
  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.1"/>
    </Sets>
  </Requirements>
  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://localhost:3000/taskpane/taskpane.html"/>
        <RequestedHeight>250</RequestedHeight>
      </DesktopSettings>
    </Form>
  </FormSettings>
  <Permissions>ReadWriteMailbox</Permissions>
  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read"/>
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Read"/>
  </Rule>
  <DisableEntityHighlighting>false</DisableEntityHighlighting>
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
      <Requirements>
        <bt:Sets DefaultMinVersion="1.12">
          <bt:Set Name="Mailbox"/>
        </bt:Sets>
      </Requirements>
      <Hosts>
        <Host xsi:type="MailHost">
          <DesktopFormFactor>
            <ExtensionPoint xsi:type="MessageReadCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="REDACTEDGroup">
                  <Label resid="REDACTEDGroupLabel"/>
                  <Control xsi:type="Button" id="REDACTEDReportButton">
                    <Label resid="REDACTEDReportButton.Label"/>
                    <Supertip>
                      <Title resid="REDACTEDReportButton.Label"/>
                      <Description resid="REDACTEDReportButton.Tooltip"/>
                    </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" />
                      <SupportsNoItemContext>true</SupportsNoItemContext>
                    </Action>
                  </Control>
                </Group>
              </OfficeTab>
            </ExtensionPoint>
          </DesktopFormFactor>
        </Host>
      </Hosts>

      <Resources>
        <bt:Images>
          <bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/icon16.png"/>
          <bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/icon32.png"/>
          <bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon80.png"/>
        </bt:Images>
        <bt:Urls>
          <bt:Url id="Init.Url" DefaultValue="https://localhost:3000/init/init.html"/>
          <bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane/taskpane.html"/>
        </bt:Urls>
        <bt:ShortStrings>
          <bt:String id="REDACTEDGroupLabel" DefaultValue="REDACTED" />
          <bt:String id="REDACTEDReportButton.Label" DefaultValue="Report Phishing">
            <bt:Override Locale="fr-fr" Value="Signaler un Phishing" />
            <bt:Override Locale="fr-ch" Value="Signaler un Phishing" />
          </bt:String>
        </bt:ShortStrings>
        <bt:LongStrings>
          <bt:String id="ActionButton.Tooltip" DefaultValue="Perform an action when clicked."/>
          <bt:String id="REDACTEDReportButton.Tooltip" DefaultValue="Report a phishing email"/>
        </bt:LongStrings>
      </Resources>

      <!-- Specifies SSO scopes and resources for the web application that hosts this add-in. -->
      <WebApplicationInfo>
        <Id>[REDACTED]</Id>
        <Resource>api://localhost:3000/[REDACTED]/Resource>
        <Scopes>
          <Scope>openid</Scope>
          <Scope>user.read</Scope>          
          <Scope>profile</Scope>
        </Scopes>
      </WebApplicationInfo>
      <ExtendedPermissions>
        <ExtendedPermission>AppendOnSend</ExtendedPermission>
      </ExtendedPermissions>
    </VersionOverrides>
  </VersionOverrides>
</OfficeApp>

1 Answer 1

0

You can use SupportsNoItemContext element for enabling your add-in to work without item context. SupportsNoItemContext is new feature that will allow an add-in to activate without the Reading Pane enabled or a message selected. It is part of 1.13 API set. For it's availability on different platforms please check here.

Sign up to request clarification or add additional context in comments.

5 Comments

This allow the Taskpane to be displayed even if no item is selected but it does not prevent it to be closed when the email is moved/deleted.
SupportsNoItemContext taskpane should not close even when item is moved/deleted. Is it closing for you ?
Yes it is, the email is moved (to junk folder). On the server using the graph is, when the change is synced in the outlook client (Outlook 365 MSO (Version 2307 Build 16.0.16626.20086) 64 bits) the display of the email disapear (this part works as expected) and the taskpane is closed
Is it possible for you to share your Add-in's manifest? On which platform are you observing this behaviour with SupportsNoItemContext Add-in ?
Edited the first message to add the manifest. Plateforme is Outlook 365 MSO (Version 2307 Build 16.0.16626.20086) 64 bits) on Windows 10.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.