RSS category feeds

RSS site feeds


Home arrow Script Collection arrow Create Outlook tasks from Taskcoach task file
Create Outlook tasks from Taskcoach task file PDF Print E-mail
This is a script which creates Outlook tasks from each task out of a Taskcoach XML-file. I saved my task to file named "My_Tasks.tsk". Please modify it for your needs.
from xml.dom import minidom
import win32com.client
from datetime import datetime
   oOutlookApp = win32com.client.gencache.EnsureDispatch("Outlook.Application")
   print "MSOutlook: unable to load Outlook"
# this should use more try/except blocks or nested blocks
#onMAPI = oOutlookApp.GetNamespace("MAPI")
#ofTasks = onMAPI.GetDefaultFolder(win32com.client.constants.olFolderTasks)
xml = r'My_Tasks.tsk'
xmldoc = minidom.parse(xml)
tcTasks = xmldoc.getElementsByTagName('task')
print 'Creating %s tasks'%len(tcTasks)
for tcTask in tcTasks:
    print 'Saving %s [%s]' % (tcTask.getAttribute('subject'), tcTask.getAttribute('status'))
    newtask = oOutlookApp.CreateItem(win32com.client.constants.olTaskItem)
    if tcTask.getAttribute('expandedContexts') != 'Dummy': #Todo: Unsichere Ecke
        newtask.Subject = tcTask.getAttribute('subject')
        for note in tcTask.getElementsByTagName('note'):
            newnote = oOutlookApp.CreateItem(win32com.client.constants.olNoteItem)
            newnote.Body += note.getAttribute('subject') + ':\n'
            for nodetext in note.getElementsByTagName('description'):
                newnote.Body +=
        for tasktext in tcTask.getElementsByTagName('description'):
                newtask.Body +=
        for attachment in tcTask.getElementsByTagName('attachment'):
            newtask.Body += 'File attachment %s:\n%s\n' % (attachment.getAttribute('subject'), attachment.getAttribute('location'))
        if tcTask.getAttribute('duedate') not in ['', None]:
            newtask.DueDate = tcTask.getAttribute('duedate')
        if tcTask.getAttribute('startdate') not in ['', None]:
            newtask.StartDate = tcTask.getAttribute('startdate')
        #elif tcTask.getAttribute('percentageComplete') in ['0', 0]:
            #newtask.Status = 0
            #newtask.PercentComplete = 0
        if tcTask.getAttribute('percentageComplete') in ['100', 100]:
            newtask.Status = 2
            newtask.PercentComplete = 100
        if tcTask.getAttribute('percentageComplete') not in ['', None, '100', 100]:
            newtask.PercentComplete = int(tcTask.getAttribute('percentageComplete'))
            newtask.Status = 5
< Prev   Next >




  • Hi Mustafa, Roberto Very interesting discussion. I think you can also use XML or... More...
  • Hello. How to connect with the currentControll er? May be using another service?... More...
  • Hi there ,I want to use this in my c# code .how can I do it please let me know.p... More...
  • I want to extract all the task information, durations, start date and end date o... More...
  • This code works very well for printing MS word file to prn. If I want print with... More...

Login Form

Lost Password?

My prefered Python IDE

My prefered Python editor is Pyscripter from MMExperts. It is not only an editor. Pyscripter is a full Python IDE including (remote) debugging, a class browser, and all other nice helpers which a full featured IDE needs.

Do you have a script for me ?

Do you have an interesting Python script which does some really cool thing on Windows ? Please post them to this site. It`s very simple - simply copy&paste it to this form. No login is requiered.

Hint: For syntax highlighting and correct Python intendation place your code between html tags <pre> and </pre>.

My prefered web framework

My prefered web framework for developing web applications is Django. Django calls itself The web framework for perfectionists with deadlines. It is a really fast, scalable and (thanks Python) the sexiest web framework of the world.