Reputation: 199
I am trying save Lync Conversation History by using Lync Client SDK from Exchange Server but "Conversation History" folder is not Present how to get this or create this folder??
Am trying with below code..
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();
}
Upvotes: 0
Views: 101
Reputation: 22032
You can create the folder using something like
Folder ConversationHistory = new Folder(service);
ConversationHistory.DisplayName = "Conversation History";
ConversationHistory.FolderClass = "IPF.Note";
FolderId MailboxToAccess = new FolderId(WellKnownFolderName.MsgFolderRoot,"[email protected]");
ConversationHistory.Save(MailboxToAccess);
I would suggest you always use the FolderId overload and specify the mailbox you want to access as using
FindFoldersResults results = svc.FindFolders(WellKnownFolderName.MsgFolderRoot, new FolderView(100));
Is ambigious and you could be accessing a different mailbox to what you expect.
Upvotes: 0