| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello
I am trying to use vbs to change all of our organization's recurrence appointments to start one hour earlier and end one hour earlier. for some reason i just can't do it. the calender is not being updated with the new times. I need all of the meetings to change! this is the code I am using: Code:
Const CdoDefaultFolderCalendar = 0 'Calendar
Const CdoDefaultFolderInbox = 1 'Inbox
Const CdoMeetingItem = 27
Const szCalendar = "Calendar"
Dim ChangeDate
'================================================= ==
Dim szServer, szMailbox
Dim mapiSession
Dim ObjFolder
Dim strday, strmonth, strYear, strHour, strMinute, strsecond
Dim strEday, strEmonth, strEYear, strEHour, strEMinute, strEsecond
Dim NewEndTime
Dim NewStartTime
Dim strAppointmentdate
'================================================= ========================
szServer = InputBox("Enter Your Exchange Server name: ", "Server Name", "IGMAIL")
szMailbox = InputBox("Enter Your Alias name: ", "Mailbox Name", "liord")
'================================================= ===========================
Set mapiSession = CreateObject("MAPI.Session")
mapiSession.Logon , , , , , , szServer & vbLf & szMailbox
Set ObjFolder = mapiSession.GetDefaultFolder(CdoDefaultFolderCalen dar)
Set objAppointments = ObjFolder.Messages
'================================================= =======================
For Each Appointment In objAppointments
If Appointment.IsRecurring = True Then
'WScript.Echo Appointment.Class
'WScript.Echo Appointment
Set objRecurPatt = Appointment.GetRecurrencePattern
'================================================= =======================
strday = Day(objRecurPatt.StartTime)
If strday < 10 Then
strday = "0" & strday
End If
strmonth = Month(objRecurPatt.StartTime)
If strmonth < 10 Then
strmonth = "0" & strmonth
End If
strYear = Year(objRecurPatt.StartTime)
strHour = Hour(objRecurPatt.StartTime) - 1
If strHour < 10 Then
strHour = "0" & strHour
End If
strMinute = Minute(objRecurPatt.StartTime)
If strMinute < 10 Then
strMinute = "0" & strMinute
End If
strsecond = "00"
'================================================= =================================
strEday = Day(objRecurPatt.EndTime)
If strEday < 10 Then
strEday = "0" & strEday
End If
strEmonth = Month(objRecurPatt.EndTime)
If strEmonth < 10 Then
strEmonth = "0" & strEmonth
End If
strEYear = Year(objRecurPatt.EndTime)
strEHour = Hour(objRecurPatt.EndTime) - 1
If strEHour < 10 Then
strEHour = "0" & strEHour
End If
strEMinute = Minute(objRecurPatt.EndTime)
If strEMinute < 10 Then
strEMinute = "0" & strEMinute
End If
strEsecond = "00"
'================================================= ================================
NewEndTime = strEmonth&"/"&strEday&"/"&strEYear & " " & strEHour&":"&strEMinute&":"&strEsecond
NewStartTime = strmonth&"/"&strday&"/"&strYear & " " & strHour&":"&strMinute&":"&strsecond
'================================================= =======================
objRecurPatt.StartTime = NewStartTime
objRecurPatt.EndTime = NewEndTime
Appointment.update makePermanent = True
'================================================= ========================
End If
Next
mapiSession.Logoff
Set mapiSession = Nothing
Please someone help me! 10x Last edited by Shadow Wizard : April 5th, 2005 at 05:15 AM. Reason: added code tags - please do it yourself with [code] and [/code] tags next. |
|
#2
|
||||
|
||||
|
I think vbscript simply does not have such power as it's only scripting language.
consider making this via full application created in language such as VB or C++ and it should work fine. anyway, maybe the problem is only with permissions, but I don't know the proper permissions you need in this case. full scale application has those by default. |
|
#3
|
|||
|
|||
|
Hello all,
Thanks to all who tried helping, but I found the mystake I made! i should have used objRecurPatt.parent.update instead of Appointment.update Thank you |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Need help updating outlook appointment using vbs |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|