Search in sources :

Example 1 with SnippetApp

use of com.microsoft.graph.snippets.application.SnippetApp 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;
}
Also used : SnippetApp(com.microsoft.graph.snippets.application.SnippetApp) Message(com.microsoft.graph.extensions.Message) ItemBody(com.microsoft.graph.extensions.ItemBody) SharedPreferences(android.content.SharedPreferences) Recipient(com.microsoft.graph.extensions.Recipient) EmailAddress(com.microsoft.graph.extensions.EmailAddress)

Aggregations

SharedPreferences (android.content.SharedPreferences)1 EmailAddress (com.microsoft.graph.extensions.EmailAddress)1 ItemBody (com.microsoft.graph.extensions.ItemBody)1 Message (com.microsoft.graph.extensions.Message)1 Recipient (com.microsoft.graph.extensions.Recipient)1 SnippetApp (com.microsoft.graph.snippets.application.SnippetApp)1