Create Outlook meeting on SharePoint page

0

Is it posible to create outlook meeting on Sharepoint page behalf on current sharepoint user? I try to create meeting by button click with next code

Application oApp = new Microsoft.Office.Interop.Outlook.Application();
AppointmentItem appointment = (AppointmentItem)oApp.CreateItem(OlItemType.olAppointmentItem);
appointment.Start = DateTime.Now.AddHours(1);
appointment.End = DateTime.Now.AddHours(2);
appointment.Subject = "Some subject";
appointment.Body = "Some body";
appointment.Recipients.Add("user1@somemail.com");
appointment.Recipients.Add("user2@somemail.com");
appointment.Save();

But i get this error, on calling appointment.Recipients

Operation aborted (Exception HRESULT: 0x80004004 (E_ABORT))

When i run this code in console application it works fine. Any ideas? Thanks in advance

sharepoint
sharepoint-2010
outlook
interop
meeting-request
asked on Stack Overflow May 16, 2015 by user2944829

1 Answer

1

The Considerations for server-side Automation of Office article states the following:

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

If you deal with Exchange profiles, you may consider using EWS (Exchange Web Services). See EWS Managed API, EWS, and web services in Exchange for more information.

answered on Stack Overflow May 16, 2015 by Eugene Astafiev

User contributions licensed under CC BY-SA 3.0