Questoin about outlook calendar

Gallagher, Tim (NE) Tim.Gallagher at gd-ais.com
Tue Aug 29 14:27:44 EDT 2006


I am trying to pull all my information from outlook calendar so I can send calendar information to my phone via email.  I have created a python script that will gather Outlook Calendar information and display it.  I am new to python and this is something that I am working on so I can get better.  Here is the problem, I am trying to get the recurring calendar entries and I am getting many errors.  Here is what I have so far.

[##START##]
import win32com.client
import time
import datetime

outlook = win32com.client.Dispatch("Outlook.Application")
namespace = outlook.GetNamespace("MAPI")
appointments = namespace.GetDefaultFolder(9).Items

#print appointments.count
x = 4  # This is a number for one of the calendar entries
print appointments[x]
print appointments[x].start
print appointments[x].end
print appointments[x].RecurrenceState
print appointments[x].EntryID
print appointments[x].IsRecurring
recItem = appointments[x].GetRecurrencePattern
print recItem  #←--------- Getting Error

[##END##]

The last line I am getting an error <bound method CDispatch.GetRecurrencePattern of <COMObject <unknown>>>
I am not sure what to do with that. Here is what Microsoft has to say about the GetRecurrencePattern. 

Set objPattern = objItem.GetRecurrencePattern
Wscript.Echo "Start time: " & objPattern.StartTime
Wscript.Echo "Start date: " & objPattern.PatternStartDate
Wscript.Echo "End date: " & objPattern.PatternEndDate


I have tried recItem.StartTime and that gives me an error 
Traceback (most recent call last):
  File "U:\scripts\python\outlook\calendar_v1.py", line 21, in ?
    print recItem.StartTime
AttributeError: 'function' object has no attribute 'StartTime'

I am not sure what to do in order to display the items within recItem.

Thanks for the help,

-T 






More information about the Python-list mailing list