如何使用C#访问Outlook用户的日历? [英] How do I access an Outlook user's calendar using C#?
本文介绍了如何使用C#访问Outlook用户的日历?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
鉴于用户的电子邮件地址,我想访问Outlook用户日历中的约会.
I want to access the appointments in an Outlook user's calendar, given the user's email address.
这大概涉及通过某种方式使用Microsoft.Office.Interop.Outlook.NameSpace
对象来获取用户的日历.
This presumably involves somehow using the Microsoft.Office.Interop.Outlook.NameSpace
object to get to the user's calendar.
推荐答案
这是 JMK 用于打开特定用户日历的特定代码段,摘录自该问题的评论中张贴的问题. >:
Here is the specific code snippet for opening a particular user's calendar, taken from the question posted in the comments on this question, by JMK:
string userName = "Foo bar";
Outlook.Application oApp;
oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon(Missing.Value, Missing.Value, true, true);
Outlook.Recipient oRecip = (Outlook.Recipient)oNS.CreateRecipient(userName);
Outlook.MAPIFolder usersCalendarFolder = (Outlook.MAPIFolder) oNS.GetSharedDefaultFolder(oRecip, Outlook.OlDefaultFolders.olFolderCalendar);
这篇关于如何使用C#访问Outlook用户的日历?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文