Reputation: 66
I need to send an appointment with user default email client (in this case is outlook only), the user must have open your outlook, I can send it from local program, but when it is on server side, I have errors because the code is without To (because is with user default email client) only From
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);
}
try in local enviroment an its Ok, open the new outlook appointment but in server enviroment have authentication error, the server have outlook, but I think that error is because not have credentials for final user machine
Thx for your answers
Upvotes: 0
Views: 995
Reputation: 66235
Outlook, just like any Office app, cannot be used i na service (such as IIS). Create a MIME message with the content type of "text/calendar" and send the iCal data using straight SMTP.
Upvotes: 1