private void SynchronizeFolderRecursive(IEFolder folder, string name, string storeID, FolderDescriptor parentDescriptor) { if (folder == null) { return; } using ( folder ) { FolderDescriptor folderDescriptor = FolderDescriptor.Get(folder); if (name != null) { folderDescriptor.Name = name; _tracer.Trace("Folder name = " + name); } else { _tracer.Trace("Folder name is unknown"); } _folders.Remove(folderDescriptor.FolderIDs.EntryId); FolderStructureDescriptor folderStruct = new FolderStructureDescriptor(parentDescriptor, folderDescriptor); Core.ResourceAP.QueueJob(folderStruct); IEFolders folders = OutlookSession.GetFolders(folder, folderDescriptor); if (folders == null) { return; } using ( folders ) { for (int i = 0; i < folders.GetCount(); ++i) { try { SynchronizeFolderRecursive(folders.OpenFolder(i), null, storeID, folderDescriptor); } catch (COMException exception) { _tracer.TraceException(exception); OutlookSession.ProblemWithOpeningFolder(folderDescriptor.FolderIDs.EntryId); break; } } } } }
protected override void Execute() { if (_folder != null && !String.IsNullOrEmpty(_folder.FolderIDs.EntryId)) { IResource resFolder = Folder.Find(_folder.FolderIDs.EntryId); if (resFolder != null) { if (!Folder.IsParentRoot(resFolder)) { Folder.SetName(resFolder, _folder.Name); } if (_isMovedFolder && _parentFolder != null) { IResource resParentFolder = Folder.Find(_parentFolder.FolderIDs.EntryId); if (resParentFolder != null) { Folder.SetParent(resFolder, resParentFolder); } } } FolderStructureDescriptor.UpdateContactFolder(_folder); } }