Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 发送与C的outlook约会_C#_Visual Studio_Email_Outlook_Appointment - Fatal编程技术网

C# 发送与C的outlook约会

C# 发送与C的outlook约会,c#,visual-studio,email,outlook,appointment,C#,Visual Studio,Email,Outlook,Appointment,我需要使用用户默认电子邮件客户端发送约会在这种情况下仅限outlook,用户必须已打开您的outlook,我可以从本地程序发送,但当它位于服务器端时,我出现错误,因为代码不带to,因为只有来自的用户默认电子邮件客户端 public void aAppointment(string subject, string body, string date, string start, string end, string location, string attend) { Outlook._N

我需要使用用户默认电子邮件客户端发送约会在这种情况下仅限outlook,用户必须已打开您的outlook,我可以从本地程序发送,但当它位于服务器端时,我出现错误,因为代码不带to,因为只有来自的用户默认电子邮件客户端

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约会,但在服务器环境中有身份验证错误,服务器有outlook,但我认为错误是因为没有最终用户计算机的凭据


与任何Office应用程序一样,Outlook不能在IIS等na服务中使用Thx for your answers

Outlook。创建一封内容类型为文本/日历的MIME邮件,并使用直接SMTP发送iCal数据。

在服务器环境中使用Office Interop是个坏主意,难怪您会头疼。Jeje这是真的,有什么好办法?