2
我需要從文件或數據庫中讀取包含姓名和電子郵件的記錄,並將其添加到現有的Oulook通訊組列表中(來自私人通訊錄,而不是來自GAL)。向私人Outlook通訊組列表添加新記錄
我剛纔看到的,從使用LINQ to我已經工作了郵件和約會DASL OL讀書的例子,但我無法弄清楚如何列出一個清單DIST的內容:
private static void GetContacts()
{
Outlook.Application app = new Outlook.Application();
Outlook.Folder folder = (Outlook.Folder)app.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
var distLists = from item in folder.Items.AsQueryable<MyDistList>()
where item.DLName == "My Dist List"
select item.Item;
var builder = new StringBuilder();
foreach (var list in distLists)
{
builder.AppendLine(list.DLName);
foreach (var item in list.Members)
{
// can't figure out how to iterate through the members here
// compiler says Object doesn't have GeNumerator...
}
}
Console.WriteLine(builder.ToString());
Console.ReadLine();
}
一旦我可以閱讀我需要的成員,以便能夠添加新的成員,這更加詭異。任何幫助,將不勝感激。