outlook api使用方法
有人用过高outlook的api么,怎么获取指定某天的所有约会呢?我看msdn上有这段代码:
MAPIFolder PastaAgendamento = Application.Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
Items ItemAgendamento = PastaAgendamento.Items.Restrict("[MessageClass]='IPM.Appointment'");
int iNumContacts = ItemAgendamento.Count;
if (iNumContacts != 0)
{
AppointmentItem c = (AppointmentItem)ItemAgendamento[0];
Console.WriteLine("约会主题:"+c.Subject.ToString());
}
但是上述表红色部分vs2008提示“非静态的字段、方法或属性“Microsoft.Office.Interop.Outlook._Application.Session.get”要求对象引用...”
如何解决呢 --------------------编程问答-------------------- 重发一些代码:
MAPIFolder PastaAgendamento = Application.Session.GetDefaultFolder(OlDefaultFolders.olFolderCalendar);
Items ItemAgendamento = PastaAgendamento.Items.Restrict("[MessageClass]='IPM.Appointment'");
int iNumContacts = ItemAgendamento.Count;
if (iNumContacts != 0)
{
AppointmentItem c = (AppointmentItem)ItemAgendamento[0];
Console.WriteLine("约会主题:"+c.Subject.ToString());
}
上面说报错的地方时这里:Application.Session.
补充:.NET技术 , C#