-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOutlookLeaveAppointmentCreation.vb
52 lines (48 loc) · 2.06 KB
/
OutlookLeaveAppointmentCreation.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Sub CreateALAppt()
Dim myItem As Object
Dim myRequiredAttendee, myOptionalAttendee, myResourceAttendee As Outlook.Recipient
Set myItem = Application.CreateItem(olAppointmentItem)
myItem.MeetingStatus = olMeeting
myItem.Subject = "<user> Annual Leave"
myItem.Location = "Out of Office"
myItem.BusyStatus = olOutOfOffice
myItem.ResponseRequested = False
'myItem.AllowNewTimeProposal = False
'myItem.AllDayEvent = True
myItem.Body = "I am out of the office on my vacation!"
'myItem.Start = #9/24/2009 1:30:00 PM#
'myItem.Duration = 90
Set myRequiredAttendee = myItem.Recipients.Add("<user> <<email>>")
myRequiredAttendee.Type = olRequired
'Set myOptionalAttendee = myItem.Recipients.Add("<other_calendar_email>;")
'myOptionalAttendee.Type = olOptional
'Set myResourceAttendee = myItem.Recipients.Add("Conf Rm All Stars")
'myResourceAttendee.Type = olResource
myItem.Display (True)
'myItem.Send
CreateALApptULIT myItem
End Sub
Private Sub CreateALApptULIT(oldItem As Object)
Dim myItem As Object
Dim myRequiredAttendee, myOptionalAttendee, myResourceAttendee As Outlook.Recipient
Set myItem = Application.CreateItem(olAppointmentItem)
myItem.MeetingStatus = olMeeting
myItem.Subject = oldItem.Subject + " - " + CStr(oldItem.Start) + " for " + CStr(oldItem.Duration / 60) + " hours"
myItem.Location = oldItem.Location
myItem.BusyStatus = olFree
myItem.ResponseRequested = False
'myItem.AllowNewTimeProposal = False
myItem.Start = oldItem.Start
myItem.AllDayEvent = True
myItem.ReminderSet = False
myItem.Body = "Automatically Generated Information:" + vbNewLine + "Starts at: " + CStr(oldItem.Start) + vbNewLine + "Goes for " + CStr(oldItem.Duration / 60) + " hours"
'myItem.Duration = 90
Set myRequiredAttendee = myItem.Recipients.Add("<boss_or_department_email>")
myRequiredAttendee.Type = olRequired
'Set myOptionalAttendee = myItem.Recipients.Add("<altemail>; <otheremail>")
'myOptionalAttendee.Type = olOptional
'Set myResourceAttendee = myItem.Recipients.Add("Conf Rm All Stars")
'myResourceAttendee.Type = olResource
myItem.Display (True)
'myItem.Send
End Sub