Search in sources :

Example 21 with PlannerTask

use of com.microsoft.graph.models.PlannerTask in project msgraph-beta-sdk-java by microsoftgraph.

the class PlannerTests method testUpdateTaskCategories.

@Test
public void testUpdateTaskCategories() {
    PlannerTask task = new PlannerTask();
    JsonObject data = new JsonObject();
    data.add("category1", new JsonPrimitive(false));
    data.add("category2", new JsonPrimitive(true));
    data.add("category3", new JsonPrimitive(false));
    data.add("category4", new JsonPrimitive(false));
    data.add("category5", new JsonPrimitive(false));
    data.add("category6", new JsonPrimitive(false));
    AdditionalDataManager dataManager = task.additionalDataManager();
    dataManager.put("appliedCategories", data);
    PlannerTask newTask = prb.tasks(planTask.id).buildRequest().get();
    PlannerTaskRequest req = prb.tasks(planTask.id).buildRequest();
    req.addHeader("If-Match", newTask.additionalDataManager().get("@odata.etag").getAsString());
    req.addHeader("If-None-Match", newTask.additionalDataManager().get("@odata.etag").getAsString());
    req.addHeader("Prefer", "return=representation");
    PlannerTask updatedTask = req.patch(task);
    JsonElement appliedCategories = updatedTask.additionalDataManager().get("appliedCategories");
    assertNotNull(appliedCategories);
}
Also used : PlannerTask(com.microsoft.graph.models.PlannerTask) PlannerTaskRequest(com.microsoft.graph.requests.PlannerTaskRequest) AdditionalDataManager(com.microsoft.graph.serializer.AdditionalDataManager) JsonPrimitive(com.google.gson.JsonPrimitive) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject) Test(org.junit.jupiter.api.Test)

Example 22 with PlannerTask

use of com.microsoft.graph.models.PlannerTask in project msgraph-beta-sdk-java by microsoftgraph.

the class PlannerTests method testDeleteTask.

@Test
public void testDeleteTask() {
    PlannerTask newTask = new PlannerTask();
    newTask.title = "Delete Me";
    newTask.planId = planId;
    newTask.bucketId = planBucket.id;
    PlannerTask task = prb.tasks().buildRequest().post(newTask);
    PlannerTaskRequest req = testBase.graphClient.planner().tasks(task.id).buildRequest();
    req.addHeader("If-Match", task.additionalDataManager().get("@odata.etag").getAsString());
    req.delete();
}
Also used : PlannerTask(com.microsoft.graph.models.PlannerTask) PlannerTaskRequest(com.microsoft.graph.requests.PlannerTaskRequest) Test(org.junit.jupiter.api.Test)

Aggregations

PlannerTask (com.microsoft.graph.models.PlannerTask)22 Test (org.junit.jupiter.api.Test)16 PlannerTaskRequest (com.microsoft.graph.requests.PlannerTaskRequest)14 JsonElement (com.google.gson.JsonElement)6 JsonObject (com.google.gson.JsonObject)4 JsonPrimitive (com.google.gson.JsonPrimitive)4 PlannerAssignment (com.microsoft.graph.models.PlannerAssignment)4 PlannerAssignments (com.microsoft.graph.models.PlannerAssignments)4 PlannerBucket (com.microsoft.graph.models.PlannerBucket)4 AdditionalDataManager (com.microsoft.graph.serializer.AdditionalDataManager)4 Gson (com.google.gson.Gson)2 PlannerChecklistItem (com.microsoft.graph.models.PlannerChecklistItem)2 PlannerTaskDetails (com.microsoft.graph.models.PlannerTaskDetails)2 User (com.microsoft.graph.models.User)2 PlannerBucketRequest (com.microsoft.graph.requests.PlannerBucketRequest)2 PlannerTaskDetailsRequest (com.microsoft.graph.requests.PlannerTaskDetailsRequest)2 AfterEach (org.junit.jupiter.api.AfterEach)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2