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;
}
Aggregations