我正在尝试使用Exchange Server中的Lync Client SDK保存Lync会话历史记录,但“对话历史记录”文件夹不存在如何获取此文件或创建此文件夹?
尝试使用以下代码..
class Program
{
static void Main(string[] args)
{
ExchangeService svc=new ExchangeService(ExchangeVersion.Exchange2010_SP1);
svc.Credentials = new NetworkCredential("User", "Password", "Domain");
svc.Url = new Uri("https://Domain/EWS/exchange.asmx");
svc.UseDefaultCredentials = true;
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
FindFoldersResults results = svc.FindFolders(WellKnownFolderName.MsgFolderRoot, new FolderView(100));
Folder MyFolder = null;
foreach (Folder item in results)
{
Console.WriteLine(item.DisplayName.ToString());
if (item.DisplayName == "conversation history")
{
Console.WriteLine("Conversation History Found.");
MyFolder = Folder.Bind(svc, item.Id);
break;
}
}
Console.ReadLine();
}
答案 0 :(得分:0)
您可以使用
之类的内容创建文件夹 Folder ConversationHistory = new Folder(service);
ConversationHistory.DisplayName = "Conversation History";
ConversationHistory.FolderClass = "IPF.Note";
FolderId MailboxToAccess = new FolderId(WellKnownFolderName.MsgFolderRoot,"Mailbox@domain.com");
ConversationHistory.Save(MailboxToAccess);
我建议您始终使用FolderId重载并使用
指定要访问的邮箱FindFoldersResults results = svc.FindFolders(WellKnownFolderName.MsgFolderRoot, new FolderView(100));
是暧昧的,你可以访问不同的邮箱,达到你的期望。