Updating an (Other) Outlook calendar (1 Viewer)

CharleyBrown99

New member
Local time
Today, 19:00
Joined
Mar 27, 2019
Messages
6
Hi
I'm really struggling to update an appointment in a calendar that's not the Default Calendar and not in the Shared Calendars folder. I've managed to test and update both of these but not the calendar I need here.
I need my access form, based on a date and subject field, to create an appointment in a Calendar that's in the "Other Calendars" folder and in a subfolder called "Deadline".
I can't change this path in that it's the decision of the company I'm working for.
Many Thanks for any help
Charley
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:00
Joined
Oct 29, 2018
Messages
21,494
Hi. Are you using a MAPI object in your code? If you have permission to edit the calendar, then you should be able to navigate to it using MAPI namespace.
 

CharleyBrown99

New member
Local time
Today, 19:00
Joined
Mar 27, 2019
Messages
6
Thanks. I have used MAPI but it keeps falling down when I specify the folder names
 

CharleyBrown99

New member
Local time
Today, 19:00
Joined
Mar 27, 2019
Messages
6
I found this code which has solved the problem for other members but it doesn't for me. I have changed the line that contains Personal folders\OtherCal for my folders but the line falls down. Thanks for any help.

Sub ApptToOtherCal()

Dim olApp As Outlook.Application
Dim olAppt As Outlook.AppointmentItem
Dim olFldr As Outlook.MAPIFolder

Set olApp = New Outlook.Application
'Set olFldr = olApp.GetNamespace("MAPI").Folders("Personal Folders").Folders("OtherCal")

Set olFldr = olApp.GetNamespace("MAPI").Folders("Other Calendars").Folders("Deadline")

Set olAppt = olFldr.Items.Add

With olAppt
.Start = Now + TimeSerial(1, 0, 0)
.End = Now + TimeSerial(2, 0, 0)
.Subject = “Post to blog”
.Save
End With

Set olApp = Nothing

End Sub
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:00
Joined
Oct 29, 2018
Messages
21,494
Hi. First of all, if you don't have permission to access the folder, you won't be able to do it with code either. Second, as I was saying, I had better luck walking through the folder structure one level at a time. For example, let's say the folder is something like Mailbox\Folder1\Folder2\Calendar, then rather than go directly like:
Code:
Set olFolder=[FONT=Courier][SIZE=2]olApp.GetNamespace("MAPI").Folders("Mailbox").Folders("Folder1").Folders("Folder2").Folders("Calendar")[/SIZE][/FONT]
I tend to use:
Code:
[FONT=Courier][SIZE=2]Set olNS = olApp.GetNamespace("MAPI")[/SIZE][/FONT]
[SIZE=2][FONT=Courier]S[/FONT][/SIZE][FONT=Courier][SIZE=2]et olFolder=olNS[/SIZE][/FONT][FONT=Courier][SIZE=2][FONT=Courier][SIZE=2].Folders("Mailbox")[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Courier][SIZE=2][FONT=Courier][SIZE=2]Set olFolder=olFolder.Folders("Folder1")[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Courier][SIZE=2][FONT=Courier][SIZE=2]Set olFolder=olFolder.Folders("Folder2")[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Courier][SIZE=2][FONT=Courier][SIZE=2]Set olFolder=olFolder.Folders("Calendar")[/SIZE][/FONT][/SIZE][/FONT]
Also, try going through from the main/root folder.
PS. The above code is untested since I don't have an example file to try right now.
 
Last edited:

CharleyBrown99

New member
Local time
Today, 19:00
Joined
Mar 27, 2019
Messages
6
Thanks to both of you. I've tried that slipstick site already (unsuccessfully) and working with one folder at a time falls down at the first point of trying. But I do appreciate the suggestions.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:00
Joined
Feb 28, 2001
Messages
27,223
TheDBGuy is right. Within much of Office, you have to worry about permissions. Don't forget that the calendar you are attempting to adjust resides in a .PST file somewhere. If it is not YOUR post-office file, the permissions will become an issue quickly.

I think it is obvious that using code, you could affect your own calendar, task list, mail, and contacts list. However, you suggest this is neither a shared calendar nor your own calendar. That means you are attempting to adjust something you probably don't own, and that is why computer permissions were invented - to keep folks from messing with your stuff! The issue will ALWAYS be that without permission to do so, you will NOT be able to do what you are asking to do.

This issue SEEMS to be an un-shared calendar for your employer. Therefore, the question is "Why is this calendar NOT shared?" That is a question you will have to bring up to the owner of that calendar.
 

CharleyBrown99

New member
Local time
Today, 19:00
Joined
Mar 27, 2019
Messages
6
Thanks again. I'm using just a stand alone version of Outlook for testing so I have full permissions. I created the Deadline folder. It's a problem with syntax and I just can't find the correct code.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:00
Joined
Oct 29, 2018
Messages
21,494
Hi. Good luck and please keep us posted as soon as you find the correct syntax.
 

Users who are viewing this thread

Top Bottom