none
How to determine the state of an email - Read mode / Compose Mode / Reply Mode from Office.context.mailbox.item RRS feed

  • Question

  • Hi Team, is there a way to determine the current state of the email. Is the email currently read / composed or replied to?

    I could not find any method in Office.context.mailbox.item which can point out the state of the email.

    Thanks,

    Nakul Virmani

    Tuesday, October 11, 2016 10:58 AM

Answers

  • Hello Nakul,

    Mailbox item doesn't have any property to indicate read/compose mode for the item. Because of different extension points for read form and edit form you always know the item is in read or compose mode. In read form you would indicate HTML file which will display your view in read mode and in edit form you would have HTML file with will display your view in compose mode.

    The following example of manifest ...

      <FormSettings>
        <Form xsi:type="ItemRead">
          <DesktopSettings>
            <SourceLocation DefaultValue="~remoteAppUrl/App/Read.html"/>
            <RequestedHeight>250</RequestedHeight>
          </DesktopSettings>
        </Form>
        <Form xsi:type="ItemEdit">
          <DesktopSettings>
            <SourceLocation DefaultValue="~remoteAppUrl/App/Compose.html"/>
          </DesktopSettings>
        </Form>
      </FormSettings>

    Hope this helps,


    Slava Ivanov

    • Marked as answer by Nakul Virmani Wednesday, October 12, 2016 11:38 AM
    Tuesday, October 11, 2016 7:06 PM
  • Hi Nakul Virmani,

    According to your description, I agree with Slava Ivanov's opinion, Mailbox item doesn't have any property to indicate read/compose mode for the item.

    In addition you could refer to itemId property gets the Exchange Web Services item identifier for the current item. Read mode only. 
    The itemId property returns null in compose mode for items that have not been saved to the store. 

    For more information, click here to refer to Office.context.mailbox.item

    Thanks for your understanding.
    • Marked as answer by Nakul Virmani Wednesday, October 12, 2016 11:38 AM
    Wednesday, October 12, 2016 6:52 AM

All replies

  • Hello Nakul,

    Mailbox item doesn't have any property to indicate read/compose mode for the item. Because of different extension points for read form and edit form you always know the item is in read or compose mode. In read form you would indicate HTML file which will display your view in read mode and in edit form you would have HTML file with will display your view in compose mode.

    The following example of manifest ...

      <FormSettings>
        <Form xsi:type="ItemRead">
          <DesktopSettings>
            <SourceLocation DefaultValue="~remoteAppUrl/App/Read.html"/>
            <RequestedHeight>250</RequestedHeight>
          </DesktopSettings>
        </Form>
        <Form xsi:type="ItemEdit">
          <DesktopSettings>
            <SourceLocation DefaultValue="~remoteAppUrl/App/Compose.html"/>
          </DesktopSettings>
        </Form>
      </FormSettings>

    Hope this helps,


    Slava Ivanov

    • Marked as answer by Nakul Virmani Wednesday, October 12, 2016 11:38 AM
    Tuesday, October 11, 2016 7:06 PM
  • Hi Nakul Virmani,

    According to your description, I agree with Slava Ivanov's opinion, Mailbox item doesn't have any property to indicate read/compose mode for the item.

    In addition you could refer to itemId property gets the Exchange Web Services item identifier for the current item. Read mode only. 
    The itemId property returns null in compose mode for items that have not been saved to the store. 

    For more information, click here to refer to Office.context.mailbox.item

    Thanks for your understanding.
    • Marked as answer by Nakul Virmani Wednesday, October 12, 2016 11:38 AM
    Wednesday, October 12, 2016 6:52 AM
  • Thanks Slava / David. I am now using itemId  to check the state of the email.

    Regards,

    Nakul Virmani

    Wednesday, October 12, 2016 11:39 AM
  • Nakul,

    Be careful to use itemId to check if item loaded into read or edit form. As indicated David, ItemId will be null only if item wasn't saved into the store. This means the item from Draft will have ItemId, but still will be loaded into edit (compose) form. It is better to check by extension point.

    Best regards,


    Slava Ivanov

    Wednesday, October 12, 2016 12:27 PM