Outlook macro to get tasks from Voo2do

Published Tue, Oct 25 2005 22:54 | girishb

Since I wrote the earlier one for populating the tasks from outlook to voo2do, its only fitting that a reverse is feasible through macros. So, here it is. This one basically retrieves the tasks that are out in voo2do and stuffs them as tasks in outlook. It assigns your projects as categories as well.

As before, copy this to your outlook macros and run it. Make sure you change the email and password in this. It might be feasible to store the loginHash itself but I did not feel like investing too much time. :)

Enjoy

Sub GetFromVoo2do()
    Dim xml As Object: Set xml = CreateObject("Microsoft.XMLHTTP")
    Dim email As String: email = "
voo2do email account"
    Dim password As String: password = "password for voo2do"
    Call xml.Open("GET", "
http://voo2do.com/api/getLoginHash?email=" & email & "&password=" & password, False)
    xml.Send
    Dim doc As Object
    Set doc = xml.responseXML
    Dim node As Object
    Set node = doc.selectSingleNode("//login")
    Dim strHash As String: strHash = node.selectSingleNode("@loginHash").nodeValue
    Dim strUser As String: strUser = node.selectSingleNode("@userId").nodeValue
    Call xml.Open("GET", "
http://voo2do.com/api/getIncompleteTasks?loginHash=" & strHash & "&userId=" & strUser, False)
    xml.Send
    Set doc = xml.responseXML
    Dim nodeList As Object
    Set nodeList = doc.selectNodes("//task")

    Dim f As MAPIFolder
    Set f = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderTasks)
    Dim t As TaskItem
    Dim tI As TaskItem

    For Each node In nodeList
        Dim strSubject As String: strSubject = node.selectSingleNode("@taskdesc").nodeValue
        Dim bFound As Boolean: bFound = False
        For Each tI In f.Items
            If tI.subject = strSubject Then
                bFound = True
                Set t = tI
                Exit For
            End If
        Next
        If bFound = False Then
            Set t = Application.CreateItem(olTaskItem)
        End If
        If (node.selectSingleNode("@deadline").nodeValue <> "") Then
            t.DueDate = node.selectSingleNode("@deadline").nodeValue
        End If
        t.Categories = node.selectSingleNode("@projName").nodeValue
        t.subject = strSubject
        t.Save
    Next
End Sub