How to create task in outlook

Hi All,

i want to create a task in outlook, how do i do that, pls guide with the steps, any video tutiorial with also work.

Hi @Rakesh_Tiwari,

I believe the objective is to create a To-Do task in Microsoft To Do based on a received email.

If yes, you can achieve this using:

  • Microsoft Graph API (recommended for a scalable and reliable solution)
  • Or install Microsoft To Do and use UI Automation to create the task

Let me know if this helps.

Thanks!


as above, i want to create a task, now suggest me what will be the correct way to do it

@Anil_G

@Rakesh_Tiwari

You can make use of Graph API which is a best way to avoid any Ui, below is the documentation for this:

You can easily utilize these API, but challenge you might have is getting access to these APIs as all the resources will be exposed to the API and you need to convience client/leads to get the access.

Another option would be to go with Ui Automation, but it may need frequent maintainance as changes happen a lot (previously we build some MS teams automation which used to fail a lot).
But if Ui Automation is not feasible with normal ways, you can try Screenplay which used AI capabilities and works on prompt and no selectors needed.
Documentation for screenplay:

There are no integration service activities available yet for tasks.

Happy automation.

If helps, kindly mark as solution so that it’ll help other as well.

If you’re looking for a straightforward way to handle this, the most common approach is using the “Create Outlook Task” activity within the Outlook 365 or Mail activity packages.
You just need to ensure your account is linked properly in the Integration Service or via the Office 365 Scope. Once that’s set, you can dynamically pass your variables (like the subject and body) directly into the activity. If you’re working with the older desktop version, the “Create Task” activity under the classic mail activities still works pretty well too.

Hi,

i found one vb code to send outlook task, whih i am adding here, and that is working fine, but i want some modification on that.
m ask is i want data in tabular format which is not coming. i need help to get that in table, below screenshot of the code and what i need.
Try

' Create Outlook application

Dim outlookApp As Application = Nothing

Try

    outlookApp = New Application()

Catch ex As System.Exception

    Throw New System.Exception("Unable to start Outlook. Please check if Outlook is installed and configured.", ex)

End Try

' Create a new Task item

Dim task As TaskItem = Nothing

Try

    task = CType(outlookApp.CreateItem(OlItemType.olTaskItem), TaskItem)

Catch ex As System.Exception

    Throw New System.Exception("Unable to create Outlook Task item.", ex)

End Try

' 3. Subject: "UK Claim- Membership# & Claim Ref#"

task.Subject = $"UK Claim- Membership# {in_MemberNumber} & Claim Ref# {in_ClaimRef}"

Dim nl As String = Environment.NewLine

' 4. Body template box (adjust text/format as needed)

'Dim htmlBody As String =

'"<html><body>" & nl &

'“

” & nl &

’ “

” & nl &

'"  <tr><td><b>Member Number</b></td><td>" & in_MemberNumber & "</td></tr>" & nl &

'"  <tr><td><b>Claim Ref#</b></td><td>" & in_ClaimRef & "</td></tr>" & nl &

'"  <tr><td><b>Reason</b></td><td>" & in_Reason & "</td></tr>" & nl &

'"  <tr><td><b>Owner Name</b></td><td>" & in_OwnerName & " (Self)</td></tr>" & nl &

'"</table>" & nl &

'"</body></html>"

'task.HTMLBody = htmlBody

Dim plainBody As String =

"Member Number : " & in_MemberNumber & nl &

"Claim Ref#    : " & in_ClaimRef & nl &

"Reason        : " & in_Reason & nl &

"Owner Name    : " & in_OwnerName & " (Self)"

task.Body = plainBody

' 5. Start date as Today

Dim today As Date = Date.Today

task.StartDate = today

' 6. Due date = 10 working days from today

Dim dueDate As Date = today

Dim workingDaysAdded As Integer = 0

While workingDaysAdded < 10

    dueDate = dueDate.AddDays(1)

    ' Monday = 1, Sunday = 7

    If dueDate.DayOfWeek <> DayOfWeek.Saturday AndAlso dueDate.DayOfWeek <> DayOfWeek.Sunday Then

        workingDaysAdded += 1

    End If

End While

task.DueDate = dueDate

' 7. Status = In Progress

task.Status = OlTaskStatus.olTaskInProgress

' 8. Priority = Normal

task.Importance = OlImportance.olImportanceNormal

' Save the task

task.Save()

Catch comEx As COMException

' Outlook COM-specific error

Throw New System.Exception("Outlook COM error occurred while creating the task: " & comEx.Message, comEx)

Catch ex As System.Exception

' Generic error

Throw New System.Exception("Error while creating Outlook Task: " & ex.Message, ex)

End Try
i am getting like below


but i want Details which is in body format in Tabular form, how to achieve it.