none
How to tell whether an appointment is repeating via Mail App APIs? RRS feed

  • Question

  • If possible, how to get detailed information such are duration and reoccuring period, please? 
    Monday, May 12, 2014 8:55 AM

Answers

  • Hi Sleepycoke,

    Yes, in a mail app, you can identify if an appointment is part of a recurring series by using the Mailbox.getCallbackTokenAysnc method. This methods gets a callback token from the Exchange server that hosts the user's mailbox. A backend third-party web service can then use this token as a bearer authorization token to call certain Exchange Web Services (EWS) on items in that mailbox: GetAttachment or GetItem. There is an example of getting a callback token and accessing the GetAttachments operation in How to: Get Attachments of an Outlook item. The way to get a token to use GetItem is similar.

    For your purpose, call the GetItem operation (http://msdn.microsoft.com/en-US/library/aa564509(v=exchg.150).aspx). In the operation response, look for the IsRecurring (http://msdn.microsoft.com/en-US/library/bb204271(v=exchg.150).aspx) and CalendarItemType (http://msdn.microsoft.com/en-US/library/aa494158(v=exchg.150).aspx) elements to identify whether the appointment belongs to a recurring series.

    If you provide an item ID of a master appointment of a recurring series when calling GetItem, then the response would include a Recurrence element (http://msdn.microsoft.com/en-us/library/office/aa580471(v=exchg.150).aspx). Depending how the recurring series is set up, that Recurrence element can contain different child elements. The following is an example:

                    <t:Recurrence>

                      <t:WeeklyRecurrence>

                        <t:Interval>1</t:Interval>

                        <t:DaysOfWeek>Tuesday</t:DaysOfWeek>

                        <t:FirstDayOfWeek>Sunday</t:FirstDayOfWeek>

                      </t:WeeklyRecurrence>

                      <t:EndDateRecurrence>

                        <t:StartDate>2014-05-06-07:00</t:StartDate>

                        <t:EndDate>2014-06-21-07:00</t:EndDate>

                      </t:EndDateRecurrence>

                    </t:Recurrence>

    Hope this helps.

     Angelgolfer

    MSFT Content Developer

    • Marked as answer by Sleepycoke Tuesday, May 13, 2014 1:07 AM
    Monday, May 12, 2014 11:20 PM
    Answerer

All replies

  • Hi Sleepycoke,

    Yes, in a mail app, you can identify if an appointment is part of a recurring series by using the Mailbox.getCallbackTokenAysnc method. This methods gets a callback token from the Exchange server that hosts the user's mailbox. A backend third-party web service can then use this token as a bearer authorization token to call certain Exchange Web Services (EWS) on items in that mailbox: GetAttachment or GetItem. There is an example of getting a callback token and accessing the GetAttachments operation in How to: Get Attachments of an Outlook item. The way to get a token to use GetItem is similar.

    For your purpose, call the GetItem operation (http://msdn.microsoft.com/en-US/library/aa564509(v=exchg.150).aspx). In the operation response, look for the IsRecurring (http://msdn.microsoft.com/en-US/library/bb204271(v=exchg.150).aspx) and CalendarItemType (http://msdn.microsoft.com/en-US/library/aa494158(v=exchg.150).aspx) elements to identify whether the appointment belongs to a recurring series.

    If you provide an item ID of a master appointment of a recurring series when calling GetItem, then the response would include a Recurrence element (http://msdn.microsoft.com/en-us/library/office/aa580471(v=exchg.150).aspx). Depending how the recurring series is set up, that Recurrence element can contain different child elements. The following is an example:

                    <t:Recurrence>

                      <t:WeeklyRecurrence>

                        <t:Interval>1</t:Interval>

                        <t:DaysOfWeek>Tuesday</t:DaysOfWeek>

                        <t:FirstDayOfWeek>Sunday</t:FirstDayOfWeek>

                      </t:WeeklyRecurrence>

                      <t:EndDateRecurrence>

                        <t:StartDate>2014-05-06-07:00</t:StartDate>

                        <t:EndDate>2014-06-21-07:00</t:EndDate>

                      </t:EndDateRecurrence>

                    </t:Recurrence>

    Hope this helps.

     Angelgolfer

    MSFT Content Developer

    • Marked as answer by Sleepycoke Tuesday, May 13, 2014 1:07 AM
    Monday, May 12, 2014 11:20 PM
    Answerer
  • Thanks a lot, Angelgolfer.

    But just to be a little more curious, is there a Java Script API to get these info conveniently? That sounds awkward to retrieve appointment properties via EWS, though feasible. If not, I hope Microsoft could provide more APIs in the future. 


    • Edited by Sleepycoke Tuesday, May 13, 2014 1:07 AM
    Tuesday, May 13, 2014 1:06 AM
  • Hi Sleepycoke,

    I see your point and will bring that up with our product team partners. Thank you for your input :-)

    Angelgolfer

    Tuesday, May 13, 2014 1:10 AM
    Answerer
  • Besides, if I am composing an email, can I still get those info? I am not sure whether EWS is holding those info since I have not submit this mail yet. 
    Tuesday, May 13, 2014 1:39 AM
  • Hi,

    getCallbackTokenAsync is actually available only when the user is reading a message or appointment, not composing. I had noticed the incorrect info in the getCallbackTokenAsync method topic and just fixed it. You will see the topic updated in tomorrow's weekly refresh.

    Angelgolfer

    Tuesday, May 13, 2014 2:21 AM
    Answerer
  • Just for confirmation, it looks that I cannot get the context of body, either. Is that true? 
    Tuesday, May 13, 2014 8:22 AM
  • Sleepycoke, can you clarify what "context" of the body you are referring to?

    If your question is whether you can get the actual body of a message or appointment - yes, you can use getCallbackTokenAysnc and GetItem (as described earlier). In a GetItem operation response, there is a Body element (http://msdn.microsoft.com/en-us/library/jj219983(v=exchg.150).aspx) which contains the body of the item.

    Since you can use getCallbackTokenAsync only when the user is viewing an item and not composing, you can access the item body only if the item has been sent (and the recipient is viewing it) and not still being composed.

    BTW, other than getting the full item body, there are "contexts" in an item subject or body that you can conveniently grab using well-known entities or regular expressions; but again, the user would have to be viewing that item, not composing. If you are interested, you can read more here:

    Tuesday, May 13, 2014 9:07 PM
    Answerer
  • Thank you very much. 
    Wednesday, May 14, 2014 12:45 AM
  • Sleepycoke, could you please share the scenario where you wanted to access the recurrence and body of the item? This API is high on our list, and we want to make sure we build it correctly, with our customers' requirements in mind.
    Wednesday, May 28, 2014 4:09 PM
  • With API you can use makeEwsRequstAsync to post ews call directly to exchange without a web service...but this requires ReadWriteMailbox permission. To get info on compose items forma workaround you can make an ews FindItem call with appropriate filter (datetimerecived, from, datetimecreated, ...) jwhich you can get from API. Just be carefull since such FindItem can return multiple results (depending on filter) and keep in mind, that user can change some properties (like subject).

    Anze Javornik

    Wednesday, May 28, 2014 5:15 PM