C# Outlook - Call Rejected By Callee

2

Trying to add an event to Outlook calendar through my event registration app using asp.net/C#. Getting call was rejected by callee error when trying to initialize (line 1). How do I overcome this issue?

Error: "Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80010001 Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))."

Outlook.Application outlookapp = new Outlook.Application();
Outlook.AppointmentItem appt = outlookapp.CreateItem(Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;
appt.Subject = er.Event.Name;
appt.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;
appt.Location = er.Event.LocationName;
appt.Start = er.Event.StartTime;
appt.End = er.Event.EndTime;
appt.Recipients.ResolveAll();
appt.Display(false);
appt.Save();
c#
.net
outlook
calendar
asked on Stack Overflow Apr 27, 2016 by Ram

2 Answers

2

Firstly, you cannot use Outlook from a service (such as IIS).

Secondly, even if your code worked, you'd end up creating an appointment and displaying (!) it locally on the server machine, where there isn't anybody to see it.

Create an iCal file and provide a link to the user - the ics file will be opened on the client machine using Outlook and the user will be able to save it.

answered on Stack Overflow Apr 27, 2016 by Dmitry Streblechenko • edited Apr 29, 2016 by Dmitry Streblechenko
0

Server-side Automation of Office is not supported

Developers can use Automation in Microsoft Office to build custom solutions that use the capabilities and the features that are built into the Office product. Although such programmatic development can be implemented on a client system with relative ease, a number of complications can occur if Automation takes place from server-side code such as Microsoft Active Server Pages (ASP), ASP.NET, DCOM, or a Windows NT service.

See : https://support.microsoft.com/en-ca/kb/257757

answered on Stack Overflow Apr 27, 2016 by Xiaoy312

User contributions licensed under CC BY-SA 3.0