import win32com.client
import datetime
# Create an instance of the Windows Calendar COM object
calendar = win32com.client.Dispatch("Outlook.Application")
# Set the reminder details
subject = "MyReminder"
body = "Characteristics of MyReminder"
start = datetime.datetime(2023, 3, 7, 14, 0)
duration = 60 # in minutes
# Create a new appointment item in the calendar
appointment = calendar.CreateItem(1) # 1 = Appointment
# Set the appointment details
appointment.Subject = subject
appointment.Body = body
appointment.Start = start
appointment.Duration = duration
appointment.ReminderSet = True
appointment.ReminderMinutesBeforeStart = 15 # reminder will appear 15 minutes before the start time
# Save the appointment to the calendar
appointment.Save()
1条答案
按热度按时间0g0grzrc1#
您可以使用
win32com.client
模块,下面是一个示例: