use of com.microsoft.graph.requests.AttachmentCollectionResponse in project msgraph-sdk-java by microsoftgraph.
the class CollectionPageSerializerTests method testAttachmentCollectionPageSerialization.
@Test
public void testAttachmentCollectionPageSerialization() throws Exception {
String expectedString = "[{\"contentBytes\":\"ZGF0YQ==\",\"name\":\"document.pdf\",\"@odata.type\":\"#microsoft.graph.fileAttachment\",\"id\":\"54321\"},{\"item\":{\"end\":{\"dateTime\":\"2018-11-18T07:30:26.544Z\",\"timeZone\":\"UTC\"},\"start\":{\"dateTime\":\"2018-10-16T06:15:26.544Z\",\"timeZone\":\"UTC\"},\"subject\":\"Test Event Subject\",\"@odata.type\":\"microsoft.graph.event\",\"id\":\"1234\"},\"name\":\"Holiday event\",\"@odata.type\":\"#microsoft.graph.itemAttachment\"},{\"item\":{\"displayName\":\"displayname\",\"mobilePhone\":\"123456890\",\"@odata.type\":\"microsoft.graph.contact\"},\"name\":\"Attachment name\",\"@odata.type\":\"#microsoft.graph.itemAttachment\"}]";
AttachmentCollectionResponse response = new AttachmentCollectionResponse();
response.value = Arrays.asList(getFileAttachment(), getItemAttachmentWithEvent(), getItemAttachmentWithContact());
AttachmentCollectionPage attachmentCollectionPage = new AttachmentCollectionPage(response, null);
JsonElement serializedJson = CollectionPageSerializer.serialize(attachmentCollectionPage, logger);
logger.logDebug(serializedJson.toString());
assertEquals(expectedString, serializedJson.toString());
}
use of com.microsoft.graph.requests.AttachmentCollectionResponse in project msgraph-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);
}
use of com.microsoft.graph.requests.AttachmentCollectionResponse in project msgraph-beta-sdk-java by microsoftgraph.
the class CollectionPageSerializerTests method testAttachmentCollectionPageSerialization.
@Test
public void testAttachmentCollectionPageSerialization() throws Exception {
String expectedString = "[{\"contentBytes\":\"ZGF0YQ==\",\"name\":\"document.pdf\",\"@odata.type\":\"#microsoft.graph.fileAttachment\",\"id\":\"54321\"},{\"item\":{\"end\":{\"dateTime\":\"2018-11-18T07:30:26.544Z\",\"timeZone\":\"UTC\"},\"start\":{\"dateTime\":\"2018-10-16T06:15:26.544Z\",\"timeZone\":\"UTC\"},\"subject\":\"Test Event Subject\",\"@odata.type\":\"microsoft.graph.event\",\"id\":\"1234\"},\"name\":\"Holiday event\",\"@odata.type\":\"#microsoft.graph.itemAttachment\"},{\"item\":{\"displayName\":\"displayname\",\"officeLocation\":\"Montreal\",\"@odata.type\":\"microsoft.graph.contact\"},\"name\":\"Attachment name\",\"@odata.type\":\"#microsoft.graph.itemAttachment\"}]";
AttachmentCollectionResponse response = new AttachmentCollectionResponse();
response.value = Arrays.asList(getFileAttachment(), getItemAttachmentWithEvent(), getItemAttachmentWithContact());
AttachmentCollectionPage attachmentCollectionPage = new AttachmentCollectionPage(response, null);
JsonElement serializedJson = CollectionPageSerializer.serialize(attachmentCollectionPage, logger);
logger.logDebug(serializedJson.toString());
assertEquals(expectedString, serializedJson.toString());
}
use of com.microsoft.graph.requests.AttachmentCollectionResponse 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();
}
use of com.microsoft.graph.requests.AttachmentCollectionResponse 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();
}
Aggregations