inserting outlook appointment using c#, asp.net

Im looking to insert an appointment in a users calendar,
I can easliy insert in my own using Microsoft.Office.Interop.Outlook.Application (below),
then add the user as a recipient, but what if I dont want to add myself, if I only want to add others? Can this be done in a similar way?

thanks

            Microsoft.Office.Interop.Outlook.Application app = null; 
            Microsoft.Office.Interop.Outlook.AppointmentItem appt = null; 
            app = new Microsoft.Office.Interop.Outlook.Application(); 

            appt = (Microsoft.Office.Interop.Outlook.AppointmentItem)app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem); 
            appt.Subject = "Meeting "; 
            appt.Body = "Test"; 
            appt.Location = "a room"; 
            appt.Start = Convert.ToDateTime("08/08/2012 05:00:00 PM"); 
            appt.Recipients.Add("<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fb9abb99d5989496">[email protected]</a>"); 
            appt.End = Convert.ToDateTime("08/08/2012 6:00:00 PM"); 
            appt.ReminderSet = true; 
            appt.ReminderMinutesBeforeStart = 15; 
            appt.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh; 
            appt.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy; 
            appt.Save();

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You cannot (or should not) use the Outlook API from an ASP.NET application. Instead Exchange Server provides a Web Services SDK that allows you to interact with the Exchange Server. The documentation has a sample of how to create appointments in a user’s mailbox.

You may have to delegate access to the user account used to execute the ASP.NET request to succesfully be able to interact with the Exchange Server API.

EWS was first introduced in Exchange 2007. For older versions of Exchange you can use Collaboration Data Objects (CDO). The Exchange 2003 SDK contains documentation on how to create appointments and meeting requests.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x