How to create appointment with all in Outlook c#

Aleš N 1 Reputation point
2022-03-07T14:57:20.627+00:00

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

180735-q-pic.jpg

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.

C#
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.
10,648 questions
Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
5,072 questions
0 comments No comments
{count} votes