Search in sources :

Example 1 with MessageCollectionPage

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

the class UserTests method meMessagesTest.

@Test
public void meMessagesTest() {
    // GET me/messages
    final MessageCollectionPage messageCollectionPage = graphServiceClient.me().messages().buildRequest().get();
    assertNotNull(messageCollectionPage);
}
Also used : MessageCollectionPage(com.microsoft.graph.requests.MessageCollectionPage) Test(org.junit.jupiter.api.Test)

Example 2 with MessageCollectionPage

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

the class UserTests method mailFoldertest.

@Test
public void mailFoldertest() {
    // GET me/mailFolders
    final MailFolderCollectionPage mailFolderCollectionPage = graphServiceClient.me().mailFolders().buildRequest().get();
    assertNotNull(mailFolderCollectionPage);
    if (mailFolderCollectionPage.getCurrentPage().size() > 0) {
        String mailFolderId = mailFolderCollectionPage.getCurrentPage().get(0).id;
        final MessageCollectionPage messageCollectionPage = graphServiceClient.me().mailFolders(mailFolderId).messages().buildRequest().get();
        assertNotNull(messageCollectionPage);
    }
}
Also used : MailFolderCollectionPage(com.microsoft.graph.requests.MailFolderCollectionPage) MessageCollectionPage(com.microsoft.graph.requests.MessageCollectionPage) Test(org.junit.jupiter.api.Test)

Example 3 with MessageCollectionPage

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

the class UserTests method meMessagesTest.

@Test
public void meMessagesTest() {
    // GET me/messages
    final MessageCollectionPage messageCollectionPage = graphServiceClient.me().messages().buildRequest().get();
    assertNotNull(messageCollectionPage);
}
Also used : MessageCollectionPage(com.microsoft.graph.requests.MessageCollectionPage) Test(org.junit.jupiter.api.Test)

Example 4 with MessageCollectionPage

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

the class OutlookTests method testSendDraft.

@Test
public void testSendDraft() {
    TestBase testBase = new TestBase();
    // Attempt to identify the sent message via randomly generated subject
    String draftSubject = "Draft Test Message " + Double.toString(Math.random() * 1000);
    Message newMessage = createDraftMessage(testBase, draftSubject);
    // Send the drafted message
    testBase.graphClient.me().mailFolders("Drafts").messages(newMessage.id).send().buildRequest().post();
    // Check that the sent message exists on the server
    MessageCollectionPage mcp = testBase.graphClient.me().messages().buildRequest().filter("subject eq '" + draftSubject + "'").get();
    assertFalse(mcp.getCurrentPage().isEmpty());
}
Also used : Message(com.microsoft.graph.models.Message) MessageCollectionPage(com.microsoft.graph.requests.MessageCollectionPage) Test(org.junit.jupiter.api.Test)

Example 5 with MessageCollectionPage

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

the class OutlookTests method testSendDraft.

@Test
public void testSendDraft() {
    TestBase testBase = new TestBase();
    // Attempt to identify the sent message via randomly generated subject
    String draftSubject = "Draft Test Message " + Double.toString(Math.random() * 1000);
    Message newMessage = createDraftMessage(testBase, draftSubject);
    // Send the drafted message
    testBase.graphClient.me().mailFolders("Drafts").messages(newMessage.id).send().buildRequest().post();
    // Check that the sent message exists on the server
    MessageCollectionPage mcp = testBase.graphClient.me().messages().buildRequest().filter("subject eq '" + draftSubject + "'").get();
    assertFalse(mcp.getCurrentPage().isEmpty());
}
Also used : Message(com.microsoft.graph.models.Message) MessageCollectionPage(com.microsoft.graph.requests.MessageCollectionPage) Test(org.junit.jupiter.api.Test)

Aggregations

MessageCollectionPage (com.microsoft.graph.requests.MessageCollectionPage)6 Test (org.junit.jupiter.api.Test)6 Message (com.microsoft.graph.models.Message)2 MailFolderCollectionPage (com.microsoft.graph.requests.MailFolderCollectionPage)2