Search in sources :

Example 1 with DateTimeTimeZone

use of com.microsoft.graph.extensions.DateTimeTimeZone in project android-java-snippets-sample by microsoftgraph.

the class EventsSnippets method createEventObject.

private static Event createEventObject() {
    Event event = new Event();
    event.subject = "Microsoft Graph SDK Discussion";
    // set start time to now
    DateTimeTimeZone start = new DateTimeTimeZone();
    start.dateTime = DateTime.now().toString();
    event.start = start;
    // and end in 1 hr
    DateTimeTimeZone end = new DateTimeTimeZone();
    end.dateTime = DateTime.now().plusHours(1).toString();
    event.end = end;
    // set the timezone
    start.timeZone = end.timeZone = "UTC";
    // set a location
    Location location = new Location();
    location.displayName = "Bill's Office";
    event.location = location;
    // add attendees
    Attendee attendee = new Attendee();
    attendee.type = AttendeeType.required;
    attendee.emailAddress = new EmailAddress();
    attendee.emailAddress.address = "mara@fabrikam.com";
    event.attendees = Collections.singletonList(attendee);
    // add a msg
    ItemBody msg = new ItemBody();
    msg.content = "Let's discuss the Microsoft Graph SDK.";
    msg.contentType = BodyType.text;
    event.body = msg;
    return event;
}
Also used : ItemBody(com.microsoft.graph.extensions.ItemBody) Event(com.microsoft.graph.extensions.Event) DateTimeTimeZone(com.microsoft.graph.extensions.DateTimeTimeZone) Attendee(com.microsoft.graph.extensions.Attendee) EmailAddress(com.microsoft.graph.extensions.EmailAddress) Location(com.microsoft.graph.extensions.Location)

Aggregations

Attendee (com.microsoft.graph.extensions.Attendee)1 DateTimeTimeZone (com.microsoft.graph.extensions.DateTimeTimeZone)1 EmailAddress (com.microsoft.graph.extensions.EmailAddress)1 Event (com.microsoft.graph.extensions.Event)1 ItemBody (com.microsoft.graph.extensions.ItemBody)1 Location (com.microsoft.graph.extensions.Location)1