var mailResults = await client.Me.Messages.ExecuteAsync(); returned From, To as null RRS feed

  • Question

  • Hi, I was following the article

    as this sample provides a means to retrieve mail messages from an O365 mailbox.

    The title of the article is:  write an ASP.NET MVC Web app to get Outlook mail.

    I followed this article step-by-step and register my O365 user with the default permission.

    I used the URL to <g class="gr_ gr_815 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="815" id="815">logon</g> to my mailbox to realize that I have a few messages in my inbox and the header/To/From are all proper. 

    But when I run the MVC application to pull messages, all the messages were pulled down in the 

    - mailResults {Microsoft.OData.ProxyExtensions.PagedCollection<Microsoft.Office365.OutlookServices.IMessage, Microsoft.Office365.OutlookServices.Message>} Microsoft.OData.ProxyExtensions.IPagedCollection<Microsoft.Office365.OutlookServices.IMessage> {Microsoft.OData.ProxyExtensions.PagedCollection<Microsoft.Office365.OutlookServices.IMessage, Microsoft.Office365.OutlookServices.Message>}

    However, when I looked at individual message properties, the subject line was retrieved properly but the From, Sender and the Recipients collection are not exposed, and returned as the following:

    From null Microsoft.Office365.OutlookServices.Recipient
    HasAttachments false bool?
    Id "AAMkAGZjZjQzN2NmLWMyNjgtNGIyOC04YWQyLTRlZDQ1YzViMGQyMABGAAAAAACf-Cf8ul6rSpqwyB_yUXfjBwBhgphZlO41TrYosrL54ns9AAAAAAE_AABhgphZlO41TrYosrL54ns9AAACd-PtAAA=" string
    Importance Normal Microsoft.Office365.OutlookServices.Importance
    IsDeliveryReceiptRequested null bool?
    IsDraft true bool?
    IsRead true bool?
    IsReadReceiptRequested false bool?
    + LastModifiedDateTime {4/20/2017 6:15:01 PM +00:00} System.DateTimeOffset?
    ParentFolderId "AQMkAGZjZjQzN2NmLWMyNjgtNGIyOC04YWQyLTRlZDQ1YzViMGQyMAAuAAADn-wn-Lpeq0qasMgfslF34wEAYYKYWZTuNU62KLKyAPniez0AAAIBPgAAAA==" string
    + ReceivedDateTime {4/20/2017 6:14:59 PM +00:00} System.DateTimeOffset?
    + ReplyTo Count = 0 System.Collections.Generic.IList<Microsoft.Office365.OutlookServices.Recipient> {Microsoft.OData.ProxyExtensions.NonEntityTypeCollectionImpl<Microsoft.Office365.OutlookServices.Recipient>}
    Sender null Microsoft.Office365.OutlookServices.Recipient
    + SentDateTime {4/20/2017 6:14:37 PM +00:00} System.DateTimeOffset?
    Subject "Message with a body and attachment" string
    + ToRecipients Count = 0 System.Collections.Generic.IList<Microsoft.Office365.OutlookServices.Recipient> {Microsoft.OData.ProxyExtensions.NonEntityTypeCollectionImpl<Microsoft.Office365.OutlookServices.Recipient>}


    I went into my Azure tenant portal and check this user's permission and I found that the application was registered by as:

    Microsoft Graph/Delegated:

    * Sign users in

    * Access User Data anytime

    * View Users' Profile Data

    * View Users' email address

    * Read User Mail

    So could this be some kind of permissions issue that the application was granted with the proper permissions to read all the mail item properties?  I need to understand how to grant more properties and see if I should reauthorize with the right credentials.

    The sample code also mentioned it was doing the extra step:

    The event handler (which we will implement shortly) will add an X-AnchorMailbox HTTP header to the outgoing API requests. Setting this header to the user's mailbox allows the API endpoint to route API calls to the appropriate backend mailbox server more efficiently.

    Not sure if this part is proper or causing more harm if O365 internal is different from the time of publication.


    Thursday, April 20, 2017 7:11 PM