use of com.microsoft.graph.extensions.ItemBody 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;
}
use of com.microsoft.graph.extensions.ItemBody in project android-java-snippets-sample by microsoftgraph.
the class MessageSnippets method createMessageObject.
private static Message createMessageObject() {
// Get a context so we can interrogate Resources & SharedPreferences
SnippetApp app = SnippetApp.getApp();
SharedPreferences prefs = SharedPrefsUtil.getSharedPreferences();
Message message = new Message();
Recipient recipient = new Recipient();
recipient.emailAddress = new EmailAddress();
recipient.emailAddress.address = prefs.getString(SharedPrefsUtil.PREF_USER_ID, "");
message.toRecipients = Collections.singletonList(recipient);
message.subject = app.getString(R.string.mail_subject);
ItemBody itemBody = new ItemBody();
itemBody.contentType = BodyType.text;
itemBody.content = app.getString(R.string.mail_body);
message.body = itemBody;
return message;
}
Aggregations