Adding Appointment Item in Outlook to Shared Calendar Folder

Status
Not open for further replies.

nola

Member
Outlook version
Outlook 2007
Email Account
Exchange Server 2007
Hi, I trying to create a new calendar appointment in Outlook using data I have from an Access database. I can get the data into Outlook fine, but I need it to go to a one of many shared calendar files that are not a part of the folder structure of the Outlook file I am logged into. The calendars do appear under the My Calendar tab and are shared with me. The appointment always shows up in the calendar that I am logged in as in Outlook. I need it to go to the shared calendar "MJP". I think I am missing a step here - any help would be greatly appreciated.


Private Sub Command61_Click()
Dim NS As Outlook.NameSpace
Dim objOwner As Outlook.Recipient
Dim oApp As Outlook.Application
Dim oItem As AppointmentItem
Dim newCalFolder As Outlook.Folder

Set oApp = Outlook.Application


If Err <> 0 Then
Set oApp = CreateObject("Outlook.Application")
End If

Set NS = oApp.GetNamespace("MAPI")
Set objOwner = NS.CreateRecipient("MJP")
objOwner.Resolve

If objOwner.Resolved Then
MsgBox objOwner.Name
Set newCalFolder = NS.GetSharedDefaultFolder(objOwner, olFolderCalendar)
End If

Set oItem = oApp.CreateItem(olAppointmentItem)

With oItem
.Subject = "This is a test "
.Start = "23/06/2015 11:45"
.Location = "Room 101"

Select Case 1
Case 1
.Display
Case 2
.Save
End Select
End With

Set oApp = Nothing
Set NS = Nothing

End Sub
 

nola

Member
Outlook version
Outlook 2007
Email Account
Exchange Server 2007
Michael - thank you SOOOOO much. Worked like a charm.
Now having a problem with missing reference MSOUTL.OLB. I know this has to do with a user that must have a different version of Outlook. I've tried late binding, but when I remove the reference and try the late binding, I can't use the code
Set newCalFolder = NS.GetSharedDefaultFolder(objOwner, olFolderCalendar)

because of the olFolderCalendar reference

Is there any way to resolve the reference problem without the late binding or some other solution? Everyone has the same version of Access, they just upgraded.
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Either add "Microsoft Outlook x Object Library" via Tools/references, or replace the constants in the code by their values.
 

nola

Member
Outlook version
Outlook 2007
Email Account
Exchange Server 2007
Either add "Microsoft Outlook x Object Library" via Tools/references, or replace the constants in the code by their values.
It's the Microsoft Outlook x Object Library that causes a problem. I add it, but when one of the users opens the Access database and does not have that version of Outlook, it flags the reference as missing or broken, then it doesn't work for anyone after that.

I'm not sure what the value would be for olFolderCalendar in the statement below, it is what is available in the reference.
Set newCalFolder = NS.GetSharedDefaultFolder(objOwner, olFolderCalendar)
 

nola

Member
Outlook version
Outlook 2007
Email Account
Exchange Server 2007
It's the Microsoft Outlook x Object Library that causes a problem. I add it, but when one of the users opens the Access database and does not have that version of Outlook, it flags the reference as missing or broken, then it doesn't work for anyone after that.

I'm not sure what the value would be for olFolderCalendar in the statement below, it is what is available in the reference.
Set newCalFolder = NS.GetSharedDefaultFolder(objOwner, olFolderCalendar)


Also tried using a string and setting it to "olFolderCalendar" and using the string in the above statement, but it would not work.
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
On your compzer where the library is available, right click on the constant, choose Definition. It will show the constant in the object browser, there see at the bottom where the value is displayed.
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
C How can I customise the list of categories shown in the dropdown list when the [Categorize] button is pressed while adding a new Calendar appointment? Using Outlook 3
S User Defined Fields adding new value (2) Using Outlook 0
M Changing the preferred order for "Put this entry in" list for adding new contacts to the Address Book Using Outlook 1
M Adding Subject to this Link-Saving VBA Outlook VBA and Custom Forms 5
E Project Management - Adding Folders for Different Folder Types Using Outlook.com accounts in Outlook 0
D Adding Enterprise Exchange Email Account to Outlook Prevents Sending via Outlook.com Account Using Outlook.com accounts in Outlook 10
S Adding new Exchange (2016) rule very slow down Microsoft Outlook Exchange Server Administration 0
Z Outlook Custom Form: Adding Dropdown(Project Code) at the end of subject Outlook VBA and Custom Forms 0
Z Adding dropdown list using custom form Outlook VBA and Custom Forms 7
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
E Unable to open Outlook 2010 after adding new email account Using Outlook 4
O Adding a new account - "CompanyL (none)" line is added Using Outlook 5
broadbander Needing help with reply/reply all while keeping attachments and adding a new CC recipient. Outlook VBA and Custom Forms 5
M adding corresponding contact form data on a mass scale Using Outlook 5
A VB to "reply all" email items stored in a folder of outlook with adding a new message Outlook VBA and Custom Forms 0
K adding more rules to 'different domains check' macro Outlook VBA and Custom Forms 2
P MS OUTLOOK 2013 - Adding Sender on the CC line Using Outlook 5
R User Defined Fields adding new value Using Outlook 3
W Adding A Macro To Message Ribbon Outlook VBA and Custom Forms 2
I Collecting mail address from GAB and adding to Outlook Task Using Outlook 2
A Outlook 2016 - adding outlook.com account creates a new/strange address Using Outlook.com accounts in Outlook 18
F Adding textbox filter to listbox? Outlook VBA and Custom Forms 2
N Recurring invite sent w/distribution list adding/removing attendees Using Outlook 0
J Issues with adding iCloud to Outlook Using Outlook 1
G Adding a contact to Outlook with a custom form using Access VBA Outlook VBA and Custom Forms 1
C Macro to send email after changing from address and adding signature Outlook VBA and Custom Forms 1
J Adding Reply & Delete to main toolbar? Using Outlook 0
T Outlook 2007 adding categories Using Outlook 15
Diane Poremsky Adding Emojis to Outlook's AutoCorrect New Slipstick.com Articles 0
T Adding "Mark As Complete" btton to Task Remindet Pop-Up Using Outlook 3
O Saving Attachments to folder on disk and adding Initials to end of file name Outlook VBA and Custom Forms 9
Ascar_CT Adding contacts on Android phone and then syncing them to Outlook Using Outlook.com accounts in Outlook 4
A Adding a 2010 sharepoint contact list to outlook 2010 address book Using Outlook 1
M Adding fields to Task in Outlook Home and Business 2010 Outlook VBA and Custom Forms 7
S Using Send on Behalf is adding extra data in from line Using Outlook 1
Lucylou Outlook 2013 Adding Outlook.com breaks profile, "Outlook not working" messag Using Outlook.com accounts in Outlook 1
C Adding Categories when Composing Email Using Outlook 1
stephenjones Adding a business account to Outlook Using Outlook 1
Chris Grew Adding 2nd Email Address BCM (Business Contact Manager) 3
G Adding an attachment to email I just created (VBA) Outlook VBA and Custom Forms 1
tswatek Inbox problems after adding MS Exchange email Using Outlook 2
L Adding sender's e-mail to global address book DL Outlook VBA and Custom Forms 1
R Adding vba to script list Outlook VBA and Custom Forms 4
F Adding User Defined Field to another form Using Outlook 0
Edaniels Adding Week Number on Calender Using Outlook 2
I Adding appointments/tasks to other user's calendar Using Outlook 1
J Adding original email text to outlook message template Outlook VBA and Custom Forms 2
Commodore Editing contacts and adding photos Using Outlook 4
D adding web address to email Using Outlook 1
T Adding text to forwarding rules in Outlook 2010 Using Outlook 1
Similar threads


















































Top