Are you sure about that? Application.CreateItem() creates new item in the
corresponding default fodler, which would be current user's Calendar folder
in your case.
How did you call MAPIFolder.Items.Add? It eother takes a message class
(string, in your case "IPM.Appointment") or one of the OlItemType enums
(olAppointmentItem in your case).
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
"Tony Gravagno" wrote in message
...
"Dmitry Streblechenko" wrote:
See Namespace.GetSharedDefaultFolder.
My code to update Exchange Server shared calendars is working.
Thanks! At this point I'm confused about why it's actually working.
(That's a new one, eh?) I login to the namespace and created a
recipient for the shared folder (doesn't seem to be a need to resolve
it). I then get a reference to the MAPIFolder:
olRemoteCalendar = olns.GetSharedDefaultFolder(
olRecipient,
PIA.Outlook.OlDefaultFolders.olFolderCalendar);
I create the AppointmentItem with no reference to the folder.
olAppointmentItem =
(PIA.Outlook.AppointmentItem)
olapp.CreateItem(
PIA.Outlook.OlItemType.olAppointmentItem);
And then I post it with the .Save() method.
It goes where it should, but I don't understand how it knows where to
save the item. I thought I would have to explicitly tell it, so I
spent hours playing with the MAPIFolder.Items.Add(object) method, but
it never seemed to accept whatever Type I put in there - including an
appointment item.
Is it correct that we're not just setting references but that we're
actually setting state when we create certain objects? The following
is my understanding based on what I'm seeing:
The Namespace comes from the App.
When the Namespace is logged into a user, it's the app that's
logged-in to that user.
Creating a MAPIFolder using GetSharedDefaultFolder doesn't just
return a reference to the folder, it sets the current folder for the
namespace and the app for subsequent operations.
The Save method on items (all of them?) saves to wherever the
application is currently pointed.
Right track?
Thanks again!