Email to task conversion

How to export Outlook emails to XMind Sync

Flagged emails in Outlook are also shown in the Task view, however, they are not visible in the XMindlook Sync Task view. This is because emails are different entities than tasks and we only support tasks for now in XMindlook. 

Fortunately, you can quickly convert email to task just by dragging the email to the Outlook bar on the left to the Task icon. A new window pop up with the email contents as the task body.

If you want even more convenient way, here is a simple VB macro that will convert email(s) to a task. The new task will have email contents and also the original email as an attachment, which makes it really easy to reply to it when the task is done. Moreover, it supports converting several flagged emails at once. Finally, the script will automatically clear the flag on the emails so that you don't get confused which item is new (but only if whole conversion was successful, so your flags are safe).

In order to use it, go to Tools -> Macros, enter script name (EmailToTask) and Create button, paste the script below and save it. You may also create a toolbar button for the macro by right clicking on the toolbar and adding a button on the Commands tab.

In Outlook 2010 and above you might need to go to Options -> Customize Ribbon and enable developer tab. After creating the macro you can add the button to the Task tool group by getting back to Customize Ribbon, creating a new group and adding newly created macro to it.

 

On Error GoTo eexit
Dim strSubject As String
Dim msg As Variant
Let strSubject = ""
Dim strBody As Variant
Dim olTask As Outlook.TaskItem
Dim strPreSubject As String

'Using object rather than MailItem, so that it
'can handle posts, meeting requests, etc as well

Dim olItem As Object
Dim olExp As Outlook.Explorer
Dim fldTask As Outlook.MAPIFolder
Dim olApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace


Set myNamespace = Application.GetNamespace("MAPI")
Set olExp = Application.ActiveExplorer
Set fldTask = myNamespace.GetDefaultFolder(olFolderTasks)
Set olTask = fldTask.Items.Add


Dim cntSelection As Integer
cntSelection = olExp.Selection.Count

For i = 1 To cntSelection
    Set olItem = olExp.Selection.Item(i)
    olItem.ClearTaskFlag
    olItem.Save
    olTask.Attachments.Add olItem
    Let strSubject = strSubject & olItem.Subject & " (" & olItem.SenderName & "-" & olItem.SentOn & " )"
    Let strBody = strBody & vbNewLine & olItem.Body

Next

olTask.Subject = strSubject
olTask.Body = strBody
olTask.Save

For i = 1 To cntSelection
    Set olItem = olExp.Selection.Item(i)
    olItem.ClearTaskFlag
    olItem.Save
Next



End
eexit:
MsgBox "There was a problem during conversion. Messages are left intact.", vbOKOnly, "Email To Task Converter"


End Sub

This script is based on the one published on the TechSupport forums: