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; } } } } }
public override AbstractJob GetNextJob() { if (_folders != null) { IEFolder folder = null; while ((_index < _count) && folder == null) { folder = _folders.OpenFolder(_index++); } if (folder != null) { _tracer.Trace("folder = " + folder.GetStringProp(MAPIConst.PR_DISPLAY_NAME)); OutlookSession.OutlookProcessor.QueueJob(new MailEnumeratorJob(folder)); return(new FolderEnumeratorJob(folder)); } } return(null); }
public static IEFolder OpenFolder(IEFolders folders, int index) { try { return(folders.OpenFolder(index)); } catch (COMException exception) { if (exception.ErrorCode == (unchecked ((int)0x8004060E)) || exception.ErrorCode == MapiError.MAPI_E_NETWORK_ERROR || exception.ErrorCode == MapiError.MAPI_E_FAILONEPROVIDER) //Folder is in offline mode or Network error { OutlookSession.ProblemWithOpeningFolder(folders.GetEntryId(index)); return(null); } if (exception.ErrorCode == MapiError.MAPI_E_EXTENDED_ERROR) { OutlookSession.ProblemWithOpeningFolder(folders.GetEntryId(index)); return(null); } throw exception; } }