[python-win32] how to get access to someone's else Outlook Calendar ?

Mark Hammond skippy.hammond at gmail.com
Tue May 11 04:01:40 CEST 2010


On 4/05/2010 6:40 AM, Stef Mientki wrote:
> Now one small question, how do I get those constants, like
> constants.olFolderCalendar (=9) ?

makepy needs to have been run for the object in question before the 
constants magically appear.  It should be as simple as using 
win32com.client.gencache.EnsureDispatch() instead of a 'plain' Dispatch.

Mark
>
> thanks,
> Stef Mientki
>
> outlook = win32com.client.Dispatch("Outlook.Application")
> namespace = outlook.GetNamespace("MAPI")
> print dir(constants)
> Item = outlook.CreateItem ( 1 ) #constants.olAppointmentItem ) #olMailItem)
> Recip = Item.Recipients.Add ( 'Klaasen, Jan' )   #<== this is not me,
> but some other !!
> Recip.Resolve ()
> if Recip.Resolved :
>    Folder = namespace.GetSharedDefaultFolder ( Recip, 9 )
> #constants.olFolderCalendar )
>    print Folder
>
>    afspraken = Folder.Items
>    afspraken.Sort("[Start]")
>    ##afspraken.IncludeRecurrences = "True"
>
>    #Possible columns are Subject, Location, Start, End, Recurrence
> Pattern, Categories
>    afspraak = afspraken.GetFirst()
>    while afspraak:
>        start = datetime.datetime.fromtimestamp (int (afspraak.Start))
>        subject = afspraak.Subject.encode("utf-8")
>        print '===', start, subject
>        afspraak = afspraken.GetNext()
>        if start.year>2011: #nextYear:
>            #avoid to loop until 2038 :-)
>            break
>
>
>
>>
>> HTH,
>>
>> Mark
>>
>> On 29/04/2010 5:34 AM, Stef Mientki wrote:
>>> hello,
>>>
>>> I want to control a number Outlook Calendars from different persons,
>>> and I have access privilges and can manipulate them through Outlook.
>>> Now I want to control them through Python.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the python-win32 mailing list