![]() |
Recurring Meetings Using VBA
I have written code to move meetings from my calendar to a public calendar.
All meetings move successfully except recurring meetings. Below is the code that I am using. Each time I use the any of the recurring objects nothing seems to happen or it fails. Any assistance would be appreciated. Code below: Sub MoveMeetings() 'Move meetings from my personal calendar to the public calendar Dim olFolder As MAPIFolder Dim olFolderSAP As MAPIFolder Dim ns As Outlook.NameSpace Dim appts As Object Dim appt As Object Dim apptrec As Object Dim SAPMeeting As Object Dim date1 As Date Dim date2 As Date Dim I As Integer Const strPublicFolder = "Public Folders\All Public Folders\SAP Calendar" Set ns = Outlook.GetNamespace("MAPI") Set olFolder = ns.GetDefaultFolder(olFolderCalendar) Set appts = olFolder.Items Set olFolderSAP = GetFolder(strPublicFolder) Set SAPMeeting = olFolderSAP.Items.Add() date1 = InputBox("Move items between - this date: ", "Start Date") date2 = InputBox("and this date: ", "End Date") For Each appt In appts If Format(appt.Start, "short date") = date1 And Format(appt.Start, "short date") date2 Then Set apptrec = appt.GetRecurrencePattern With SAPMeeting .Subject = appt.ConversationTopic .Start = appt.Start .End = appt.End .Location = appt.Location .Organizer = appt.Organizer .Body = appt.Body .RequiredAttendees = appt.RequiredAttendees .OptionalAttendees = appt.OptionalAttendees .RecurrenceType = apptrec.RecurrenceType .Interval = apptrec.Interval .PatternEndDate = apptrec.PatternEndDate .Save End With End If Next appt End Sub WD |
Recurring Meetings Using VBA
I want to add one additional thing to this:
What would the approach be if a meeting I wanted to move to the public calendar had an attachment? What would the approach be? ... if there is a place on the web that I can look to understand this some more let me know. Thanks again. "WD" wrote: I have written code to move meetings from my calendar to a public calendar. All meetings move successfully except recurring meetings. Below is the code that I am using. Each time I use the any of the recurring objects nothing seems to happen or it fails. Any assistance would be appreciated. Code below: Sub MoveMeetings() 'Move meetings from my personal calendar to the public calendar Dim olFolder As MAPIFolder Dim olFolderSAP As MAPIFolder Dim ns As Outlook.NameSpace Dim appts As Object Dim appt As Object Dim apptrec As Object Dim SAPMeeting As Object Dim date1 As Date Dim date2 As Date Dim I As Integer Const strPublicFolder = "Public Folders\All Public Folders\SAP Calendar" Set ns = Outlook.GetNamespace("MAPI") Set olFolder = ns.GetDefaultFolder(olFolderCalendar) Set appts = olFolder.Items Set olFolderSAP = GetFolder(strPublicFolder) Set SAPMeeting = olFolderSAP.Items.Add() date1 = InputBox("Move items between - this date: ", "Start Date") date2 = InputBox("and this date: ", "End Date") For Each appt In appts If Format(appt.Start, "short date") = date1 And Format(appt.Start, "short date") date2 Then Set apptrec = appt.GetRecurrencePattern With SAPMeeting .Subject = appt.ConversationTopic .Start = appt.Start .End = appt.End .Location = appt.Location .Organizer = appt.Organizer .Body = appt.Body .RequiredAttendees = appt.RequiredAttendees .OptionalAttendees = appt.OptionalAttendees .RecurrenceType = apptrec.RecurrenceType .Interval = apptrec.Interval .PatternEndDate = apptrec.PatternEndDate .Save End With End If Next appt End Sub WD |
Recurring Meetings Using VBA
Nothing different should need to be done for items with attachments. The
Move method will move those along with their associated messages. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "WD" wrote in message ... I want to add one additional thing to this: What would the approach be if a meeting I wanted to move to the public calendar had an attachment? What would the approach be? ... if there is a place on the web that I can look to understand this some more let me know. Thanks again. |
Recurring Meetings Using VBA
I certainly wouldn't touch the RecurrencePattern property unless I knew the
item was a recurring item or wanted to make it one. Just retrieving that property makes the item recurring. Check for .IsRecurring first. If you do have a recurring item get the master recurring item (RecurrencePattern.Parent) and try moving that, it should move the entire series. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "WD" wrote in message ... I have written code to move meetings from my calendar to a public calendar. All meetings move successfully except recurring meetings. Below is the code that I am using. Each time I use the any of the recurring objects nothing seems to happen or it fails. Any assistance would be appreciated. Code below: Sub MoveMeetings() 'Move meetings from my personal calendar to the public calendar Dim olFolder As MAPIFolder Dim olFolderSAP As MAPIFolder Dim ns As Outlook.NameSpace Dim appts As Object Dim appt As Object Dim apptrec As Object Dim SAPMeeting As Object Dim date1 As Date Dim date2 As Date Dim I As Integer Const strPublicFolder = "Public Folders\All Public Folders\SAP Calendar" Set ns = Outlook.GetNamespace("MAPI") Set olFolder = ns.GetDefaultFolder(olFolderCalendar) Set appts = olFolder.Items Set olFolderSAP = GetFolder(strPublicFolder) Set SAPMeeting = olFolderSAP.Items.Add() date1 = InputBox("Move items between - this date: ", "Start Date") date2 = InputBox("and this date: ", "End Date") For Each appt In appts If Format(appt.Start, "short date") = date1 And Format(appt.Start, "short date") date2 Then Set apptrec = appt.GetRecurrencePattern With SAPMeeting .Subject = appt.ConversationTopic .Start = appt.Start .End = appt.End .Location = appt.Location .Organizer = appt.Organizer .Body = appt.Body .RequiredAttendees = appt.RequiredAttendees .OptionalAttendees = appt.OptionalAttendees .RecurrenceType = apptrec.RecurrenceType .Interval = apptrec.Interval .PatternEndDate = apptrec.PatternEndDate .Save End With End If Next appt End Sub WD |
Recurring Meetings Using VBA
Ken -
Are you saying that I should use the Move Method as opposed to the approach that I am taking with Add? I noticed that some of the objects are read-only...is there other objects that provide the access for writing/changing? "Ken Slovak - [MVP - Outlook]" wrote: Nothing different should need to be done for items with attachments. The Move method will move those along with their associated messages. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "WD" wrote in message ... I want to add one additional thing to this: What would the approach be if a meeting I wanted to move to the public calendar had an attachment? What would the approach be? ... if there is a place on the web that I can look to understand this some more let me know. Thanks again. |
Recurring Meetings Using VBA
I would certainly use the Move method unless you want to retain a copy of
the item in the original folder. Many Outlook properties are read-only, if that's what you're asking. Some are read-only for the Outlook object model and can be changed using some other API such as CDO 1.21 or Extended MAPI or Redemption. Others can only be set before the first time the item is saved. Others can only be set by Outlook or the store provider or the MAPI transport and are out of your control. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "WD" wrote in message ... Ken - Are you saying that I should use the Move Method as opposed to the approach that I am taking with Add? I noticed that some of the objects are read-only...is there other objects that provide the access for writing/changing? |
All times are GMT +1. The time now is 08:56 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com