2009-12-23 19 views
5

Aşağıdaki kodu kullanarak başka bir kişinin Microsoft Outlook (2003) takviminde bir randevu oluşturmaya çalışıyorum.Bu programı çalıştırırken, Randevu benim takvimimde kaydediliyor.Ama alıcıya gönderilmiyor.Microsoft Outlook takvimine nasıl randevu oluşturur ve gönderirim?

try 
{ 
    Microsoft.Office.Interop.Outlook.Application app = null; 
    Microsoft.Office.Interop.Outlook.AppointmentItem appt = null; 

    app = new Microsoft.Office.Interop.Outlook.Application(); 

    appt = (Microsoft.Office.Interop.Outlook.AppointmentItem)app 
     .CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem); 
    appt.Subject = "Meeting "; 
    appt.Body = "Test Appointment body"; 
    appt.Location = "TBD"; 
    appt.Start = Convert.ToDateTime("12/23/2009 05:00:00 PM"); 
    appt.Recipients.Add("[email protected]"); 
    appt.End = Convert.ToDateTime("12/23/2009 6:00:00 PM"); 
    appt.ReminderSet = true; 
    appt.ReminderMinutesBeforeStart = 15; 
    appt.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh; 
    appt.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy; 
    appt.Save(); 
    appt.Send(); 
} 
catch (COMException ex) 
{ 
    Response.Write(ex.ToString()); 
} 

Am ben bir şey eksik? Bu sorunu çözmek için bana yardımcı olabilir misiniz? ekleyerek

cevap

3

Dene:

appt.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting; 

Standart durumu ben gönderiliyor emin değilim randevu olduğunu.

5

Eğer randevunuz sonra:

I (Sonny Boy'un yayını gibi) koyun:

Ama aynı zamanda zorunda

İşte
Outlook.MailItem mailItem = appt.ForwardAsVcal(); 
mailItem.To = "recipient's email address"; 
mailItem.Send(); 
1

Bu sorunu giderdik nasıl Bir web.config dosyası oluşturun ve herhangi bir COMException'dan kaçınmak için yetkilendirmeyi etkinleştirin:

<system.web> 
    <authorization> 
    <deny users="?"/> 
    </authorization> 
</system.web> 
İlgili konular