searched all entries on the topic and I am close to solution but help is appreciated: I want to create calendar entries in a non-default calendar in Outlook via python. I did
import win32com.client
outlook = win32com.client.Dispatch('Outlook.Application').GetNamespace('MAPI')
calendar = outlook.Folders('[email protected]').Folders('calendar').Folders('subcalendar')
I can read entries, count entries of the subcalendar - all good. Now I try to create a new item in this 'subcalendar' by
newapp = calendar.CreateItem(1)
newapp.Start = '2020-09-25 08:00'
newapp.Subject = 'Testentry'
newapp.Duration = 15
newapp.Save()
throwing error: AttributeError:< unknown >.CreateItem.
I am calling the object 'subcalendar' with the Method CreateItem and the correct object type...seems I am blind but do not see the solution. Thanks for any help on this!
You can use the following code:
The Items.Add method creates a new Outlook item in the
Items
collection for the folder. If the type is not specified, theType
property of the Outlook item defaults to the type of the folder or toMailItem
if the parent folder is not typed.You may find the How To: Create a new Outlook Appointment item article helpful.