Create Task with Attachment (one drive/sharepoint document attachment) , Due date and priority - Using Postman

Anonymous
2022-09-01T13:36:23.75+00:00

Hi

I am able to create a blank task using postman. (Graph API)

My requirement is that, I have a word document in one drive/SharePoint. I am trying to link the one drive/SharePoint document to the created task as a attachment(Teams files or URL). Also i want to create that task with start date , due date and priority. Also how to add description/notes if possible.

I don't know how to configure the body content of postman. Is even it possible to attach document in creating a task with the graph API.
Could someone help me with this.

Thank you

Microsoft Security Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Srinivasa Rao Darna 6,761 Reputation points Microsoft External Staff
    2022-09-01T17:47:13.44+00:00

    Hi @Anonymous ,

    You can use update planner task details, in the request body can pass attachment references property plannerexternalreferences.
    A example snippet would be as below.

    PATCH https://graph.microsoft.com/v1.0/planner/tasks/{task-id}/details  
    Content-type: application/json  
    Prefer: return=representation  
    If-Match: "JzEtVGFzayAgQEBAQEBAQEBAQEBAQEBAWCc="  
      
    {  
    "previewType": "noPreview",  
    "references": {  
        "https%3A//contoso%2Esharepoint%2Ecom/teams/agile/documents/AnnualReport%2Epptx": {  
            "@odata.type": "microsoft.graph.plannerExternalReference",  
            "alias": "Agile Team Annual Report",  
            "previewPriority": "0009005756397228702",  
            "type": "PowerPoint"  
        }  
      }  
    }  
    

    Properities like dueDateTime and assigneePriority can be set in POST or PATCH of plannertask.

    Hope this helps.
    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.