Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

EventMessage object properties are null with the exception of the subject property after casting from Message #84

Open
JohnMAustin78 opened this issue May 21, 2015 · 3 comments

Comments

@JohnMAustin78
Copy link

When I get a Message object from my inbox that is an instance of EventMessage (and represents a meeting invitation), the EventMessage object I get when casting from Message has all null properties with the exception of the Subject property. In consequence, I cannot get the Event object after calling EventMessage.getEvent().


 public boolean respondToEmailInvite(Message emailInvite) throws ExecutionException, InterruptedException, RuntimeException {
        if ((emailInvite instanceof EventMessage) == false)
            return false;
        CalendarSnippets calendarSnippets = new CalendarSnippets(mOutlookClient);

        EventMessage eventMessage = (EventMessage)emailInvite;

        String eventId = eventMessage.getEvent().getId();
        calendarSnippets.respondToCalendarEventInvite(
                eventId
                , GlobalValues.USER_EMAIL
                , ResponseType.Accepted);


        return true;
    }
@JohnMAustin78
Copy link
Author

Upon further review, the message collection is retrieved with a select statement:
public List getMailMessages() throws ExecutionException, InterruptedException {
List messages = mOutlookClient
.getMe()
.getFolders()
.getById("Inbox")
.getMessages()
.select("Subject")
.orderBy("DateTimeReceived desc")
.top(EMAIL_PAGE_SIZE)
.read().get();
return messages;

Add "Event" to the select list and the event property is no longer null.

@JohnMAustin78
Copy link
Author

Upon further testing, removing the select clause from the getMessages() method call returns all of the message properties. However, for the EventMessage ODATA type, the Event property is still null.

@JohnMAustin78 JohnMAustin78 reopened this May 26, 2015
@marcote
Copy link
Contributor

marcote commented May 27, 2015

@JohnAustin-MSFT but, what about the raw payload? Are you retrieving the actual Event? I would like to see what's the actual request you're executing and what's the raw payload. If the Event is part of the payload, then we may have a Deserialization problem.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants