how to create new events share calendar with python with win32com

오광준 1 Reputation point
2021-10-28T04:54:11.54+00:00

i want to create new events share calendar.
so i use python code example

but don't opearating
help me

this is python code

import win32com.client

outlook = win32com.client.Dispatch("Outlook.Application") #operate app
namespace = outlook.GetNamespace("MAPI") #get api

recipient = namespace.createRecipient("kjoh@dunamiscap.com") # input my email
recipient.Resolve()

calendar = namespace.GetSharedDefaultFolder(recipient, 9) #get share calender
calendar_folder = calendar.Folders['IPO_P'] #input share calender name ( exist name)
appointment = calendar_folder.Items.Add(1) # 1=outlook appointment item ( create events)
appointment.Start = '2021-10-28 08:00'
appointment.Subject = "Test booking"
appointment.Duration = 60
appointment.Save()

but run this code

error message -pywintypes.com_error: (--2147352567, 'Exception occurred', (4096, 'Microsoft Outlook', 'You do not have permission to create an item in this folder.

i did check my permission from share calendar owner
if you can, help me please

Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
5,281 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.