C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,208 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have troubles with sending appointments to shared calendar programatically. I know that the standard way is as below:
MAPIFolder sharedFolder = mapiNamespace.GetSharedDefaultFolder(recipient, OlDefaultFolders.olFolderCalendar);
Outlook.AppointmentItem newAppointment = sharedFolder.Items.Add(Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;
//Outlook.AppointmentItem newAppointment = sharedFolder.Items.Add("IPM.Appointment"); ///Second option
But probably it is equal to clicking into shared calendar and require write rights.
I need to do it as below in GUI, this allow to send appointment even if I do not have write rights:
NOTE: (In English) New appointment --> New appointment with all
NOTE2: If I send it by standard way (see code below), it will not send it to shared folder (also it is not in sent folder).
Outlook.AppointmentItem newAppointment = (Outlook.AppointmentItem)application.CreateItem(Outlook.OlItemType.olAppointmentItem);
newAppointment.Start = startT;// DateTime.Now.AddHours(2);
newAppointment.End = stopT;
newAppointment.Subject = name;
newAppointment.Location = loc;
newAppointment.Body = body;
newAppointment.AllDayEvent = false;
//newAppointment.Recipients.Add(application.Session.CurrentUser.Name);
for (int i = 0; i < rec.Count; i++) newAppointment.Recipients.Add(rec[i]);
Outlook.Recipients sentTo = newAppointment.Recipients;
sentTo.ResolveAll();
newAppointment.Save();
newAppointment.Display(true);
newAppointment.Close(OlInspectorClose.olSave);
Thank you in advance for your answers.