NVIT
asked on
How send appointment to certain Outlook calendar?
In the client's office, users all run Outlook.
No Exchange is used.
Each user's Outlook is stored in a .pst file.
In Outlook, one can have multiple calendars.
This client wants each user to have, in addition to the user's default Outlook calendar, a calendar dedicated to office events, i.e. an Office Calendar. Events / appointments in the office calendar should be separate from the user's default Outlook calendar.
In Outlook, you can create a new event/appointment. In that event, if you pick Invite Attendees, you can email it to various users.
Once the event is emailed, on the recipient's Outlook, when the calendar event is received, is there a way to send that event to the Office Calendar?
If so, can this be done via...
- Fancy vanilla Outlook setup?
- Or, via VBA programming?
- Or, via 3rd party programs?
No Exchange is used.
Each user's Outlook is stored in a .pst file.
In Outlook, one can have multiple calendars.
This client wants each user to have, in addition to the user's default Outlook calendar, a calendar dedicated to office events, i.e. an Office Calendar. Events / appointments in the office calendar should be separate from the user's default Outlook calendar.
In Outlook, you can create a new event/appointment. In that event, if you pick Invite Attendees, you can email it to various users.
Once the event is emailed, on the recipient's Outlook, when the calendar event is received, is there a way to send that event to the Office Calendar?
If so, can this be done via...
- Fancy vanilla Outlook setup?
- Or, via VBA programming?
- Or, via 3rd party programs?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
- I presume I put the code into ThisOutlookSession?
In regards to most of your questions the code will need some modification. If you know the folder structure where this calendar will be placed, please supply it. I will be happy to help.
Yes: this is the easiest method
- I think your code puts the received appt into folder: Backup Routine. Correct?
How this works is when new appointment is added to the default calendar folder and the subject line contains "FIRMWIDE" it will be moved to another folder. For my example I used "Backup Routine"
- Must folder Backup Routine exist? Or, is it created automatically?
No, This was just an example you can place it in any folder as long as the path is correctly entered in the code.
- Must Subject String be exact? Or, can it be a prefix, e.g. FIRMWIDE - Category 1? Or, FIRMWIDE - Category
No, just contain it anywhere in the subject. You can also use category field rather than the subject.
In regards to most of your questions the code will need some modification. If you know the folder structure where this calendar will be placed, please supply it. I will be happy to help.
ASKER
Thank you, YoBee...
I put this code into Outlook 2007.
I'd like to put into Outlook 2013 but don't' know how to get to the VBA code screen.
Outlook 2007 calendar has the option New Folder. But, I don't see that in Outlook 2013. I only see...
- New Calendar Group
- or, Add Calendar > Open shared calendar.
Forgive my ignorance but... I don't know what Calendar Groups and Shared Calendars are for. hehe.
I put this code into Outlook 2007.
I'd like to put into Outlook 2013 but don't' know how to get to the VBA code screen.
Outlook 2007 calendar has the option New Folder. But, I don't see that in Outlook 2013. I only see...
- New Calendar Group
- or, Add Calendar > Open shared calendar.
Forgive my ignorance but... I don't know what Calendar Groups and Shared Calendars are for. hehe.
Private WithEvents m_colCalendarItems As Outlook.Items
Private Sub Application_startup()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
' default local Inbox
'Set Items = objNS.GetDefaultFolder(olFolderCalendar).Items
Set m_colCalendarItems = objNS.GetDefaultFolder(olFolderCalendar).Items
End Sub
Private Sub m_colCalendarItems_ItemAdd(ByVal Item As Object)
Call UpdateReminder(Item)
End Sub
Sub UpdateReminder(Item As Object)
Dim ObjCalFolder As Outlook.MAPIFolder
'Rename the "Backup Routine" to the Calendar name in your mailbox.
Set ObjCalFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Parent.Folders("Backup Routine")
If Item.Class = olAppointment Then
'Change the Subject String to something that matches your environment.
If InStr(1, Item.Subject, "RHA event") Then
Item.Move ObjCalFolder
End If
End If
End Sub
ASKER
Thank you for the VBA tip.
> If you know the folder structure where this calendar will be placed, please supply it.
Below the default calendar, I'd like a folder named "RHA event"
> If you know the folder structure where this calendar will be placed, please supply it.
Below the default calendar, I'd like a folder named "RHA event"
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi yo_bee...
I added your most recent change above.
I make an event with the subject prefix "RHA event" and invite (email) 1 user.
I don't think the code is running when I send the invite. I put a break point inside Sub UpdateReminder but it's not hitting it.
The event ends up in the default calendar.
I've tested sends from both Outlook 2007 and 2013.
I added your most recent change above.
I make an event with the subject prefix "RHA event" and invite (email) 1 user.
I don't think the code is running when I send the invite. I put a break point inside Sub UpdateReminder but it's not hitting it.
The event ends up in the default calendar.
I've tested sends from both Outlook 2007 and 2013.
Private WithEvents m_colCalendarItems As Outlook.Items
Private Sub Application_startup()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
' default local Inbox
'Set Items = objNS.GetDefaultFolder(olFolderCalendar).Items
Set m_colCalendarItems = objNS.GetDefaultFolder(olFolderCalendar).Items
End Sub
Private Sub m_colCalendarItems_ItemAdd(ByVal Item As Object)
Call UpdateReminder(Item)
End Sub
Sub UpdateReminder(Item As Object)
Dim ObjCalFolder As Outlook.MAPIFolder
'Rename the "Backup Routine" to the Calendar name in your mailbox.
'Set ObjCalFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Parent.Folders("Backup Routine")
Set ObjCalFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Folders("RHA event")
If Item.Class = olAppointment Then
'Change the Subject String to something that matches your environment.
If InStr(1, Item.Subject, "RHA event") Then
Item.Move ObjCalFolder
End If
End If
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
> ...and press F5 or run the macro. Each time you make a change you will need to do that.
Or, I presume, close Outlook. Then start it again.
I'll test this when I get in. Thanks, Yo_bee
Or, I presume, close Outlook. Then start it again.
I'll test this when I get in. Thanks, Yo_bee
That will do the trick as well
ASKER
Sorry. Just a minute. Let me confirm that error.
ASKER
Getting there...
Sending from Outlook 2007, it worked. Thanks again, yo_bee. If I make the event from the default calendar, I end up with just 1 event as expected placed in the correct calendar "RHA Event"
But, it seems to make a copy instead of moving it. Or, maybe when it is moved the name is prefixed with string "Copy"
Sending from Outlook 2007, it worked. Thanks again, yo_bee. If I make the event from the default calendar, I end up with just 1 event as expected placed in the correct calendar "RHA Event"
But, it seems to make a copy instead of moving it. Or, maybe when it is moved the name is prefixed with string "Copy"
ASKER
My latest code... pretty much same as yours except added UCASE on line 30
Private WithEvents m_colCalendarItems As Outlook.Items
Private Sub Application_startup()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
' default local Inbox
'Set Items = objNS.GetDefaultFolder(olFolderCalendar).Items
Set m_colCalendarItems = objNS.GetDefaultFolder(olFolderCalendar).Items
End Sub
Private Sub m_colCalendarItems_ItemAdd(ByVal Item As Object)
Call UpdateReminder(Item)
End Sub
Sub UpdateReminder(Item As Object)
Dim ObjCalFolder As Outlook.MAPIFolder
'Rename the "Backup Routine" to the Calendar name in your mailbox.
'Set ObjCalFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Parent.Folders("Backup Routine")
Set ObjCalFolder = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderCalendar).Folders("RHA event")
If Item.Class = olAppointment Then
'Change the Subject String to something that matches your environment.
If InStr(1, UCase(Item.Subject), "RHA EVENT") Then
Item.Move ObjCalFolder
End If
End If
End Sub
ASKER
Another effect of the "Copy" issue...
If the originator cancels or Deletes the event, it doesn't send the update to the recipients as before.
If the originator cancels or Deletes the event, it doesn't send the update to the recipients as before.
I would have to do some testing on my end to see if I can replicate what you are seeing.
Give me a day or so.
Give me a day or so.
ASKER
Thanks, yo_bee. That's much appreciated.
ASKER
Hi yo_bee. Just wondering if you had a chance to make progress on this.
If not, I'll just buy a 3rd party tool.
If not, I'll just buy a 3rd party tool.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
ASKER
Although it's not the ideal solution, I've given you the points.
thanks, but I would give some more insight what was beneficial. I may help another use some of the information to help with their inquiry.
ASKER
Thanks for the code.
I haven't run it yet but I have some questions...
- I presume I put the code into ThisOutlookSession?
- Does the code run automatically? Or, do I have to assign it to a command icon?
- I think your code puts the received appt into folder: Backup Routine. Correct?
- Must folder Backup Routine exist? Or, is it created automatically?
- Must Subject String be exact? Or, can it be a prefix, e.g. FIRMWIDE - Category 1? Or, FIRMWIDE - Category 2