해결할 수없는 약간의 문제가 있습니다. C#, Visual Studio 2010 및 Outlook 라이브러리를 사용하고있는 오류 페이지로 작업하고 있습니다. 내 프로젝트에서 다음 라이브러리를 추가했습니다. "Microsoft.Office.Interop.Outlook" Visual Studio에서 제공하는 서버를 사용하여 웹 사이트를 실행하면 페이지가 완벽하게 작동합니다. IIS를 통해 페이지를 실행하면 로깅됩니다. "다음 오류로 인해 CLSID가 {0006F03A-0000-0000-C000-000000000046} 인 구성 요소의 COM 클래스 팩터 리를 검색 할 수 없습니다 : 80070005 액세스가 거부되었습니다. (예외 HRESULT : 0x80070005 (E_ACCESSDENIED)). "IIS에서 Outlook 라이브러리를 실행하지 못했습니다.
왜 그런지 알 수 있습니까? 문제를 해결하려면 어떻게해야합니까?
나는 C#을 사용하여 Outlook 약속을 만들 내 서버의 폴더 중 하나에이 약속을 저장 한 후 이메일에 첨부 보낼, 내가 그것을 어떻게 할 수 있습니까? 당신은 IIS 응용 프로그램에서 Outlook을 자동화하기 위해 노력하고있다처럼
using Microsoft.Office.Interop;
using Outlook = Microsoft.Office.Interop.Outlook;
using System.Net.Mail;
Outlook.Application outlookApp = (Outlook.Application)new Outlook.Application();
Outlook.AppointmentItem appointment = (Outlook.AppointmentItem)outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
appointment.Subject = subject;
appointment.Body = comments;
appointment.Location = location;
appointment.StartUTC = dateInit;
appointment.EndUTC = dateEnd;
appointment.ReminderSet = true;
appointment.ReminderMinutesBeforeStart = advideInMinutes;
appointment.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
string appointmentPath = "c:\\webroot\\appointment\\appointmentName.msg";
appointment.SaveAs(appointmentPath);
MailMessage mail = new MailMessage();
mail.To.Add(new System.Net.Mail.MailAddress("[email protected]"));
mail.From = new System.Net.Mail.MailAddress("[email protected]", "MyName", System.Text.Encoding.UTF8);
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.BodyEncoding = System.Text.Encoding.UTF8;
mail.IsBodyHtml = true;
mail.Priority = MailPriority.Normal;
Attachment appointmentAttahment = new Attachment(appointmentPath);
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("authsmtp.mydomain.com");
smtp.Credentials = new System.Net.NetworkCredential(Settings.Items["[email protected]", "password");
smtp.EnableSsl = false;
smtp.Send(mail);
appointmentAttahment.Dispose();