I was tasked with fiding way how to add approved vacations to calendar from database. So I made this simple code:
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application")
def sendMeeting():
appt = outlook.CreateItem(1) # AppointmentItem
appt.Start = "2021-12-09 10:10" # yyyy-MM-dd hh:mm
appt.Subject = "Test test"
appt.Duration = 60
appt.Location = "Out of office"
appt.MeetingStatus = 1 # 1 - olMeeting; Changing the appointment to meeting. Only after changing the meeting status recipients can be added
appt.Organizer = "michal.liska@havelpartners.cz"
appt.Recipients.Add("michal.liska@havelpartners.cz") # Don't end ; as delimiter
appt.Save()
appt.Send()
print("sent")
sendMeeting()
This is all well, but problem is that if I sent the meeting It also appear in my calendar. So If I was to create it for 100 users my callendar would be spammed.
Also I can't connect directly to server and creating something more complex like this: Sending Meeting Invitations With Python. This is not desirable, because I presume, that I would need get login and password for all the users.
So is there some simple way to do it? Meaby just delete it afterwards or outlook parameter, that I can disable it with?