Search in sources :

Example 6 with AttachmentCollectionPage

use of com.microsoft.graph.requests.AttachmentCollectionPage in project msgraph-sdk-java by microsoftgraph.

the class OutlookTests method sendEmailWithAttachment.

@Test
public void sendEmailWithAttachment() throws Exception {
    TestBase testBase = new TestBase();
    Message message = getMessage();
    message.hasAttachments = true;
    AttachmentCollectionResponse response = new AttachmentCollectionResponse();
    response.value = Arrays.asList(getFileAttachment(), getItemAttachmentWithEvent(), getItemAttachmentWithContact());
    message.attachments = new AttachmentCollectionPage(response, null);
    testBase.graphClient.me().sendMail(UserSendMailParameterSet.newBuilder().withMessage(message).withSaveToSentItems(true).build()).buildRequest().post();
}
Also used : AttachmentCollectionPage(com.microsoft.graph.requests.AttachmentCollectionPage) Message(com.microsoft.graph.models.Message) AttachmentCollectionResponse(com.microsoft.graph.requests.AttachmentCollectionResponse) Test(org.junit.jupiter.api.Test)

Example 7 with AttachmentCollectionPage

use of com.microsoft.graph.requests.AttachmentCollectionPage in project msgraph-beta-sdk-java by microsoftgraph.

the class OutlookTests method sendEmailWithAttachment.

@Test
public void sendEmailWithAttachment() throws Exception {
    TestBase testBase = new TestBase();
    Message message = getMessage();
    message.hasAttachments = true;
    AttachmentCollectionResponse response = new AttachmentCollectionResponse();
    response.value = Arrays.asList(getFileAttachment(), getItemAttachmentWithEvent(), getItemAttachmentWithContact());
    message.attachments = new AttachmentCollectionPage(response, null);
    testBase.graphClient.me().sendMail(UserSendMailParameterSet.newBuilder().withMessage(message).withSaveToSentItems(true).build()).buildRequest().post();
}
Also used : AttachmentCollectionPage(com.microsoft.graph.requests.AttachmentCollectionPage) Message(com.microsoft.graph.models.Message) AttachmentCollectionResponse(com.microsoft.graph.requests.AttachmentCollectionResponse) Test(org.junit.jupiter.api.Test)

Example 8 with AttachmentCollectionPage

use of com.microsoft.graph.requests.AttachmentCollectionPage in project msgraph-beta-sdk-java by microsoftgraph.

the class OutlookTests method sendEventWithAttachment.

@Test
public void sendEventWithAttachment() throws Exception {
    TestBase testBase = new TestBase();
    Event event = getEvent();
    event.body = getItemBody();
    event.hasAttachments = true;
    AttachmentCollectionResponse response = new AttachmentCollectionResponse();
    response.value = Arrays.asList(getFileAttachment(), getItemAttachmentWithContact());
    event.attachments = new AttachmentCollectionPage(response, null);
    Event eventResponse = testBase.graphClient.me().events().buildRequest().post(event);
    assertNotNull(eventResponse);
}
Also used : AttachmentCollectionPage(com.microsoft.graph.requests.AttachmentCollectionPage) AttachmentCollectionResponse(com.microsoft.graph.requests.AttachmentCollectionResponse) Event(com.microsoft.graph.models.Event) Test(org.junit.jupiter.api.Test)

Aggregations

AttachmentCollectionPage (com.microsoft.graph.requests.AttachmentCollectionPage)8 Test (org.junit.jupiter.api.Test)8 AttachmentCollectionResponse (com.microsoft.graph.requests.AttachmentCollectionResponse)6 JsonElement (com.google.gson.JsonElement)2 Attachment (com.microsoft.graph.models.Attachment)2 Event (com.microsoft.graph.models.Event)2 FileAttachment (com.microsoft.graph.models.FileAttachment)2 ItemAttachment (com.microsoft.graph.models.ItemAttachment)2 Message (com.microsoft.graph.models.Message)2