use of com.microsoft.graph.options.QueryOption 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);
User me = testBase.graphClient.me().buildRequest().get();
Recipient r = new Recipient();
EmailAddress address = new EmailAddress();
address.address = me.mail;
r.emailAddress = address;
Message message = new Message();
message.subject = draftSubject;
ArrayList<Recipient> recipients = new ArrayList<Recipient>();
recipients.add(r);
message.toRecipients = recipients;
message.isDraft = true;
// Save the message as a draft
Message newMessage = testBase.graphClient.me().messages().buildRequest().post(message);
// Send the drafted message
testBase.graphClient.me().mailFolders("Drafts").messages(newMessage.id).send().buildRequest().post();
java.util.List<QueryOption> options = new ArrayList<QueryOption>();
QueryOption o = new QueryOption("$filter", "subject eq '" + draftSubject + "'");
options.add(o);
// Check that the sent message exists on the server
IMessageCollectionPage mcp = testBase.graphClient.me().messages().buildRequest(options).get();
assertFalse(mcp.getCurrentPage().isEmpty());
}
use of com.microsoft.graph.options.QueryOption in project msgraph-sdk-java by microsoftgraph.
the class SharePointTests method testSearch.
@Test
public void testSearch() {
List<Option> requestOptions = new LinkedList<Option>();
requestOptions.add(new QueryOption("search", "Contoso"));
ISiteCollectionPage sites = testBase.graphClient.sites().buildRequest(requestOptions).get();
assertNotNull(sites);
}
use of com.microsoft.graph.options.QueryOption in project msgraph-sdk-java by microsoftgraph.
the class SharePointTests method setUp.
@Before
public void setUp() {
testBase = new TestBase();
List<Option> requestOptions = new LinkedList<Option>();
requestOptions.add(new QueryOption("search", "Contoso"));
ISiteCollectionPage sites = testBase.graphClient.sites().buildRequest(requestOptions).get();
testSite = sites.getCurrentPage().get(0);
}
use of com.microsoft.graph.options.QueryOption in project msgraph-sdk-java by microsoftgraph.
the class BaseCollectionRequestTests method testQueryParameters.
@Test
public void testQueryParameters() {
final Option q1 = new QueryOption("q1", "option1 ");
final Option q2 = new QueryOption("q2", "option2");
final BaseCollectionRequest<String, String> request = new BaseCollectionRequest<String, String>("https://a.b.c", null, Arrays.asList(q1, q2), null, null) {
};
assertEquals("https://a.b.c?q1=option1+&q2=option2", request.getRequestUrl().toString());
request.addQueryOption(new QueryOption("q3", "option3"));
assertEquals("https://a.b.c?q1=option1+&q2=option2&q3=option3", request.getRequestUrl().toString());
assertEquals(4, request.getOptions().size());
}
use of com.microsoft.graph.options.QueryOption in project msgraph-sdk-java by microsoftgraph.
the class BaseRequestTests method testProtectedProperties.
@Test
public void testProtectedProperties() {
assertEquals(0, request.functionOptions.size());
assertEquals(0, request.queryOptions.size());
final Option q1 = new QueryOption("q1", "option1 ");
final Option f1 = new FunctionOption("f1", "option2");
final BaseRequest request = new BaseRequest("https://a.b.c", null, Arrays.asList(q1, f1), null) {
};
assertEquals(1, request.functionOptions.size());
assertEquals(1, request.queryOptions.size());
assertEquals("q1", request.queryOptions.get(0).getName());
assertEquals("option1 ", request.queryOptions.get(0).getValue());
assertEquals("f1", request.functionOptions.get(0).getName());
assertEquals("option2", request.functionOptions.get(0).getValue());
}
Aggregations