用C#发送outlook预约
问题描述:
我需要发送与用户默认电子邮件客户端的预约(在这种情况下仅用于Outlook),用户必须打开您的Outlook,我可以从本地程序发送它,但是当它服务器端,我有错误,因为代码是没有要(因为是用户默认邮件客户端)只能从用C#发送outlook预约
public void aAppointment(string subject, string body, string date, string start, string end, string location, string attend)
{
Outlook._NameSpace ns = null;
Outlook.Application apptApp = new Outlook.Application();
Outlook.AppointmentItem appt =
apptApp.CreateItem(Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;
ns = apptApp.GetNamespace("MAPI");
ns.Logon(null, null, false, false);
apptApp.ActiveWindow();
appt.MeetingStatus = Outlook.OlMeetingStatus.olMeeting;
appt.Subject = subject;
appt.Body = body;
appt.AllDayEvent = false;
appt.Start = DateTime.Parse(date + " " + start);
appt.Location = location;
appt.End = DateTime.Parse(date + " " + end);
appt.RequiredAttendees = attend;
appt.Display(false);
}
尝试在本地环境的它的确定,打开新的Outlook约会,但在服务器环境有认证错误,服务器有前景,但我认为,错误是因为没有最终用户机器的凭据
Thx for your answers
答
与任何Office应用程序一样,Outlook不能用于服务(如IIS)。创建一个内容类型为“text/calendar”的MIME消息,并使用直接SMTP发送iCal数据。
在服务器环境中使用Office Interop是一个糟糕的主意,难怪你头疼。 – Equalsk
Jeje它的真实,什么是一个好方法? –