Calendars

Status
Not open for further replies.

wedwards123

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hi i have access to 2 calendars. I want :

Calendar A meetings to be copied to Calendar B

OR a default setting that means every new meeting started a set email is automatically invited.
 
Both are doable - you can use VBA to do both or create a custom meeting form that includes the email address. Using a macros means it only works on the computer where the macro is installed. Using a custom form will work on any computer where you use Outlook with your exchange server.
 
Thanks for the response Diane,

I believed both were possible but was unsure how to go about doing either.

I'm happy for the macro to work on just the computer its installed on, i've written an alternative macro that SHOULD add example@example.com to the OptionalAttendees but instead REPLACES the OptionalAttendees with example@example.com for the whole year but i would like it to add the email to the list of OptionalAttendees BUT if it appears in the OptionalAttendees list then don't send.

In my current code below i've tried OptionalAttendees.Add but this returns a object error:

Sub calendar_copy()

Dim MailboxName

Dim Calendar_ID

Dim myNamespace As Outlook.NameSpace

Dim myRecipient As Outlook.Recipient

Dim CalFolder As MAPIFolder

Set objOutlook = GetNamespace("MAPI")

Dim CalendarFolder As Outlook.Folder

'- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'

'change the mailbox name to that of the shared calendar - for own calendar enter personal email address '-

MailboxName = "example@example.com" '-

'-

'- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'

Set myNamespace = Application.GetNamespace("MAPI")

Set myRecipient = myNamespace.CreateRecipient(MailboxName)

myRecipient.Resolve

Set Calendar_ID = Outlook.Session.GetSharedDefaultFolder(myRecipient, olFolderCalendar)

'- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'

Set CalFolder = Calendar_ID

Set calitem = CalFolder.Items

MyStart = "01/01/2013"

MyStart = Format(MyStart, "dd/mm/yyyy")

MyEnd = "31/12/2013"

MyEnd = Format(MyEnd, "dd/mm/yyyy")

'Restricts the subject to "Test A " only

RestrictMeetings = "[Start] >= '" & MyStart & "' AND [End] <= '" & MyEnd & "' And [Subject] > 'Test a' and [subject] < 'Test z'"

Set targetitems = calitem.Restrict(RestrictMeetings)

For Each meetingsubject In targetitems

meetingsubject.OptionalAttendees = "example@example.com"

meetingsubject.Display

Next

End Sub

Both are doable - you can use VBA to do both or create a custom meeting form that includes the email address. Using a macros means it only works on the computer where the macro is installed. Using a custom form will work on any computer where you use Outlook with your exchange server.
 
Hi Diane - thanks for the reply.

I believe both were doable, but just wasn't sure how to go about it.

I've put some code together that SHOULD ADD example@example.com to the OptionalAttendees list for the whole year if it doesn't apear in the list already AND then only send update ONLY to this email (updated invitees) but instead it actually REPLACES any OptionalAttendees with example@example.com and sends the update to all.

In my code below i've tried to use OptionalAttendees.Add but it returns an object error, the code below is the one that actually replaces the OptionalAttendees.

Sub calendar_copy()

Dim MailboxName

Dim Calendar_ID

Dim myNamespace As Outlook.NameSpace

Dim myRecipient As Outlook.Recipient

Dim CalFolder As MAPIFolder

Set objOutlook = GetNamespace("MAPI")

Dim CalendarFolder As Outlook.Folder

'- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'

'change the mailbox name to that of the shared calendar - for own calendar enter personal email address '-

MailboxName = "example@example.com" '-

'-

'- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'

'This refers to the example Calendar ID

Set myNamespace = Application.GetNamespace("MAPI")

Set myRecipient = myNamespace.CreateRecipient(MailboxName)

myRecipient.Resolve

Set Calendar_ID = Outlook.Session.GetSharedDefaultFolder(myRecipient, olFolderCalendar)

'- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --'

Set CalFolder = Calendar_ID

Set calitem = CalFolder.Items

MyStart = "01/01/2013"

MyStart = Format(MyStart, "dd/mm/yyyy")

MyEnd = "31/12/2013"

MyEnd = Format(MyEnd, "dd/mm/yyyy")

'Restricts the subject to "Test a" to "Test z"only

RestrictMeetings = "[Start] >= '" & MyStart & "' AND [End] <= '" & MyEnd & "' And [Subject] > 'Test a' and [subject] < 'Test z'"

Set targetitems = calitem.Restrict(RestrictMeetings)

For Each meetingsubject In targetitems

meetingsubject.OptionalAttendees = "example@example.com"

meetingsubject.Send

Next

End Sub

Both are doable - you can use VBA to do both or create a custom meeting form that includes the email address. Using a macros means it only works on the computer where the macro is installed. Using a custom form will work on any computer where you use Outlook with your exchange server.
 
To fix the organizer part, instead of using
meetingsubject.OptionalAttendees = "example@example.com"

try
meetingsubject.OptionalAttendees = "example@example.com;" & meetingsubject.OptionalAttendees

using .add is better but you need to do it as a recipient, not optionalattendee (since we aren't using cdo).

For Each meetingsubject In targetitems
Set objRecip = meetingsubject.Recipients.Add("mary@here.com")
objRecip.Type = olOptional
meetingsubject.Display ' i like to use display for testing
 
Thanks Dianne,

I typed the response twice as i wasn't sure if it had submitted the first time, sorry.

And i believe the snippit of code you gave me has worked, now just for a few extra tests.

thanks again.:cool:

To fix the organizer part, instead of using

meetingsubject.OptionalAttendees = "example@example.com"

try

meetingsubject.OptionalAttendees = "example@example.com;" & meetingsubject.OptionalAttendees

using .add is better but you need to do it as a recipient, not optionalattendee (since we aren't using cdo).

For Each meetingsubject In targetitems

Set objRecip = meetingsubject.Recipients.Add("mary@here.com")

objRecip.Type = olOptional

meetingsubject.Display ' i like to use display for testing
 
It's the forums fault. :) I don't know why the forum puts your posts into moderation. Unless it's the multiple email addresses counting as urls (but they are not converted to urls).
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Hide/disable "Groups", "Shared Calendars" Using Outlook 2
T Never-ending Reminders in Shared Calendars Using Outlook 3
V Outlook 2016 iCloud for Windows - Why no working Calendars and Tasks ? Using Outlook 1
N Outlook 365 How to show all calendars at startup? Outlook VBA and Custom Forms 0
O Newbie question: how to sync two Outlook -Exchange and IMAP- calendars? Using Outlook 4
P Syncing Outlook & iPhone Calendars Using Outlook 4
H Synchronize contacts and calendars across multiple devices Using Outlook 0
G Outlook 365 with iCloud account not syncing calendars Using Outlook 2
J Multiple calendars Using Outlook 0
Graham Hyman Outlook 2016 Internet Calendars appearing as deleted Using Outlook 4
C Pull Outlook shared calendars items from Excel Outlook VBA and Custom Forms 4
M Outlook 365 Searching all shared calendars Outlook VBA and Custom Forms 4
N Gathering Calendar Appointments from Calendars that synced as Contacts Exchange Server Administration 1
B How to sync Outlook, iphone and Google calendars and contacts? Using Outlook 4
B Sharing Outlook calendars gone wrong Using Outlook 0
V Multiple Calendars in Outlook To-Do Bar; Office 365 Using Outlook 3
D Sharing outlook.com calendars in Outlook 2016 Using Outlook 1
D Sharing calendars Exchange Server Administration 1
P Outlook room resource calendars and best practices Exchange Server Administration 0
K Can VBA intervene when updating Internet Calendars? Outlook VBA and Custom Forms 5
C Sync Calendars using WiFI Using Outlook 3
P Can't sync iPhone calendars with Outlook Using Outlook 4
L Calendars in Outlook 2016 Using Outlook 0
Carrie Dickey Outlook 2016 created two calendars titled Calendar1 - appear to be a copy Using Outlook 2
A Helping OL remember which calendars were selected Using Outlook 6
Diane Poremsky New in Office 365 and Outlook.com: Interesting Calendars Using Outlook 0
Diane Poremsky Combine and Print Multiple Outlook Calendars Using Outlook 0
Jeanne Goodman Create Printout from Multiple Shared Calendars Outlook VBA and Custom Forms 8
Diane Poremsky Publishing Calendars on the Internet or an Intranet Using Outlook 0
Diane Poremsky Printing Calendars with Color Categories Using Outlook 0
Diane Poremsky Select Multiple Calendars in Outlook Using Outlook 0
Diane Poremsky Sharing Outlook.com Calendars Using Outlook 0
C Merge two archive calendars Using Outlook 1
makinmyway Appointments Created in iCloud Calendars Cover Contacts Field...Why? Using Outlook 3
Mark Foley Time span on WebDAV published Calendars does not appear to be working Using Outlook 7
M Reminders or Notifications for Internet Calendars Using Outlook 1
M Copy new appointments created in multiple shared calendars to another exchange calendar Outlook VBA and Custom Forms 1
Diane Poremsky Print Monthly or Work Week Calendars Using Outlook 0
Diane Poremsky No drop down calendars in Outlook 2010 Print Options Using Outlook 0
H Other peoples calendars going on the left Using Outlook 1
J Printing Mulitple Calendars Outlook VBA and Custom Forms 1
Diane Poremsky Print Monthly or Work Week Calendars Using Outlook 0
M Un-needed Calendars Using Outlook 1
R Automating from excel into shared Calendars Using Outlook 1
M Not All Outlook.com Calendars Showing in Outlook.com Using Outlook.com accounts in Outlook 18
T populating multiple calendars without invites Using Outlook 1
T Consollidating all calendars to Outlook online, even from POP3 email invitations. Using Outlook 2
ACM Viewing Outlook calendars on multiple devices Using Outlook 3
P syncing outlook calendars Using Outlook 12
E Some Calendars Not Visible After Transfer Using Outlook 2

Similar threads

Back
Top