Record Appointment to Calendar on "Public Folder"

Status
Not open for further replies.

djsupersain

Member
Outlook version
Outlook 2016 64 bit
Email Account
Office 365 Exchange
Hi All,

Please if anyone can help that would be greatly appreciated.

I have Office 2016 Desktop connecting to Office365.

I have made a custom form and got the code from here to create a link in the Ribbon etc. It works perfectly to my personal calendar but I would like it to record to a Public Calendar that I have.

Please is someone able to assist with my code?

The structure for my calendar is:

Public Folders - test@test.com
> All Public Folders
>Test Folder
> Test Calendar

Below is my code for the custom form:

Sub MakeItem()
Set newItem = Application.CreateItemFromTemplate("C:\Users\Test\AppData\Roaming\Microsoft\Templates\Test.oft")
newItem.Display
Set newItem = Nothing
End Sub

Thank you so much in advance.
 
when you use templates, you need to move the appointment after it is created as it will use the default folder.

Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder

Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.GetDefaultFolder(olPublicFoldersAllPublicFolders).folders("test folder").folders ("test calendar")
objfolder.move newitem


Working with VBA and non-default Outlook Folders

As an FYI, you shouldn't use "too many dots" and should break the lines like this. While it shouldn't be an issue with the path you are using (so either method should be fine), if you go deeper, splitting in into groups like below is better than one long string.
Set objParentFolder = objNS.GetDefaultFolder(olPublicFoldersAllPublicFolders)
Set objFolder = objParentFolder.folders("test folder")
Set myFolder = objFolder.folders ("test calendar")
 
Hi,

Thank you for your response, greatly appreciated.

I wish I could say I fully understand but I'm a little lost please help? below is what I have amended but still recording to Local Calendar.

Thank you in advance.

Sub MakeItem()
Set newItem = Application.CreateItemFromTemplate("C:\Users\test\AppData\Roaming\Microsoft\Templates\JobBookingNZ.oft")
newItem.Display
Set newItem = Nothing
Set objParentFolder = objNS.GetDefaultFolder(olPublicFoldersAllPublicFolders)
Set objFolder = objParentFolder.folders("test folder")
Set myFolder = objFolder.folders ("test calendar")
End Sub
 
You need to set the folder and move it before you set newitem to nothing.

Code:
Sub MakeItem()
Set objParentFolder = objNS.GetDefaultFolder(olPublicFoldersAllPublicFolders)
Set objFolder = objParentFolder.folders("test folder")
Set myFolder = objFolder.folders ("test calendar")

Set newItem = Application.CreateItemFromTemplate("C:\Users\test\AppData\Roaming\Microsoft\Templates\JobBookingNZ.oft")
newItem.Display
myfolder.move newitem
Set newItem = Nothing
End Sub
 
Hi,

And again thank you, I'm receiving a "Runtime error 424 object required" ?
 
oh - you need to set objNS
Set objNS = Application.GetNamespace("MAPI")

Hi,

Now getting "Runtime error 438. Object doesn't support this property or method" ?

Sub MakeItem()
Set objNS = Application.GetNamespace("MAPI")
Set objParentFolder = objNS.GetDefaultFolder(olPublicFoldersAllPublicFolders)
Set objFolder = objParentFolder.folders("test folder")
Set myFolder = objFolder.folders ("test calendar")

Set newItem = Application.CreateItemFromTemplate("C:\Users\test\AppData\Roaming\Microsoft\Templates\JobBookingNZ.oft")
newItem.Display
myfolder.move newitem
Set newItem = Nothing
End Sub
 
Thank you Diane, this is now working :) but...

As soon as I run the macro, it opens my form/appointment, then a pop up with "Responses to this meeting will not be tallied. If you want outlook to tally responses for you, move the meeting to the calendar folder for this account".

Then you click the only option available "OK" and it closes the form/appointment, however I have not been able to even put any details in on that form? But! it does end up on the shared folder :)

Thank you again for all your help.

Outlook 2016 Desktop Application.
 
As soon as I run the macro, it opens my form/appointment, then a pop up with "Responses to this meeting will not be tallied. If you want outlook to tally responses for you, move the meeting to the calendar folder for this account".
you can't avoid that when you move meeting requests to a different calendar.


If you weren't use a template, you could use items.add

Set newitem = myFolder .Items.Add(olappointmentitem)

You can try replacing the move line with this:
Set moveCal = newitem .Move(myfolder)
moveCal.display
moveCal.Save
 
Hi Diane,

Ok, could I add an "item" using a template? with out emailing etc... ?
 
no, not to my knowledge. With templates you need to use Move.

But by setting the moved item to a variable, you can work with it after the move. That's what this does:
Set moveCal = newitem .Move(myfolder)
moveCal.display
moveCal.Save

Nothing, short of using your own default calendar, will eliminate the 'will not be tallied' message.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D DB/Object/Record vs File/List/Range Terminology Outlook VBA and Custom Forms 0
A Record opened emails for reopening later Using Outlook 2
A Record opened emails for reopening later Outlook VBA and Custom Forms 16
B Track Record Activity Using Outlook 1
B Customize contact record phone fields Using Outlook 2
B Macro to record what time it is Outlook VBA and Custom Forms 2
N linking an already sent/rec'd email to contact record like it did in 2000 Using Outlook 0
M convert/import a customized record into the default "Account" record BCM (Business Contact Manager) 0
P People/Contact Record gets deleted when I edit it? Using Outlook 3
S Editing an email with notes and saving it for record using Macro Outlook VBA and Custom Forms 3
U No scrolling in note field of contact record Using Outlook 1
R Can BCM monitor and select specific emails and use content info to update the client's record? BCM (Business Contact Manager) 1
M Predefined Outlook Fields not available to add into a BCM record BCM (Business Contact Manager) 0
J How to show the "value" of a user-defined Account field in a Contact Record BCM (Business Contact Manager) 2
J How to create fields that will use the same value on different record types BCM (Business Contact Manager) 2
A delete database --> record remnants ?? BCM (Business Contact Manager) 3
M BCM 2010 Link to Record (very) slow BCM (Business Contact Manager) 2
L Importing multiple record from .vcf (vCard) file Using Outlook 5
P Hyperlink to Access record/Form Outlook VBA and Custom Forms 2
H Re: record of sales for each contact BCM (Business Contact Manager) 1
A Is There An Easier Way to Access a Business Contact Record? BCM (Business Contact Manager) 2
A Programmatically duplicating BCM's "Link to Record" function BCM (Business Contact Manager) 2
C Outlook record the step I take getting to the user template? Outlook VBA and Custom Forms 1
S Record eMail details in Outlook 2007 Outlook VBA and Custom Forms 5
R One Click business contact record creation - From an E Mail? BCM (Business Contact Manager) 1
Y How to record macros in Outlook2007? Outlook VBA and Custom Forms 1
Y Q's on Appointment Reminders Using Outlook 2
V VBA Categories unrelated to visible calendar and Visual appointment Categories Outlook VBA and Custom Forms 2
M using excel to sort outlook appointment items Outlook VBA and Custom Forms 4
F Add a category before "Send an Email When You Add an Appointment to Your Calendar" Outlook VBA and Custom Forms 0
B Linking contact to an Appointment Using Outlook 1
S Appointment font size when printing only changes Tasks' font Using Outlook 0
D Copy Appointment Body to Task Body Outlook VBA and Custom Forms 0
S New Outlook Appointment - Select All Body Text and Change Font and Size Outlook VBA and Custom Forms 1
e_a_g_l_e_p_i Outlook 2010 How can I change the font size on right side appointment pane Using Outlook 12
Chiba Create an appointment for all the members Outlook VBA and Custom Forms 1
D Prevent popup of "Do you want to save changes?" when closing after opening an appointment to view Outlook VBA and Custom Forms 2
O Calendar - appointment templates and categories Using Outlook 1
W Appointment userproperties disappear Outlook VBA and Custom Forms 4
Nessa Can't create new appointment Using Outlook 1
F Appointment Show All Fields Using Outlook 1
C Trying to populate an appointment ComboBox from Excel Outlook VBA and Custom Forms 2
A Possible to hide ribbon with custom appointment form? Outlook VBA and Custom Forms 3
W Appointment occurrences change the location property Using Outlook 0
W Space in an Outlook appointment body Using Outlook 0
Dave A Run macro on existing appointment when it changes Outlook VBA and Custom Forms 1
JoeG Appointment Delete/Change Recurrence Outlook VBA and Custom Forms 0
S Display PF contact folder items to select contact to link to appointment Outlook VBA and Custom Forms 1
M Forward Appointment as BCC with VBScript Outlook VBA and Custom Forms 7
K Update Appointment category when changed in Excel Using Outlook 3

Similar threads

Back
Top