public void WriteRules(IDestinationFolder targetFolder, Action <List <BadMessageRec> > reportBadItemsDelegate) { if (this.FolderType == FolderType.Search) { return; } CommonUtils.ProcessKnownExceptions(delegate { targetFolder.SetRules(this.Rules); }, delegate(Exception ex) { if (reportBadItemsDelegate != null && CommonUtils.ExceptionIsAny(ex, new WellKnownException[] { WellKnownException.DataProviderPermanent, WellKnownException.MapiNotEnoughMemory })) { List <BadMessageRec> list = new List <BadMessageRec>(1); list.Add(BadMessageRec.Folder(this.FolderRec, BadItemKind.CorruptFolderRule, ex)); reportBadItemsDelegate(list); return(true); } return(false); }); }
private T ReadFolderData <T>(Func <T> getDataDelegate, Action <List <BadMessageRec> > reportBadItemsDelegate, Func <byte[], IFolder> openFolderDelegate) where T : class { T result = default(T); CommonUtils.ProcessKnownExceptions(delegate { CommonUtils.TreatMissingFolderAsTransient(delegate { result = getDataDelegate(); }, this.EntryId, openFolderDelegate); }, delegate(Exception ex) { if (reportBadItemsDelegate != null && CommonUtils.ExceptionIsAny(ex, new WellKnownException[] { WellKnownException.DataProviderPermanent, WellKnownException.CorruptData, WellKnownException.NonCanonicalACL })) { List <BadMessageRec> list = new List <BadMessageRec>(1); list.Add(BadMessageRec.Folder(this.FolderRec, BadItemKind.CorruptFolderACL, ex)); reportBadItemsDelegate(list); return(true); } return(false); }); return(result); }
public void EnumerateRestriction(FolderRec folderRec, BadItemKind badItemKind, RestrictionData rest) { if (rest != null) { CommonUtils.ProcessKnownExceptions(delegate { rest.EnumeratePropTags(new CommonUtils.EnumPropTagDelegate(this.EnumeratePtag)); }, delegate(Exception ex) { if (this.reportBadItemsDelegate != null && CommonUtils.ExceptionIsAny(ex, new WellKnownException[] { WellKnownException.DataProviderPermanent, WellKnownException.CorruptData })) { List <BadMessageRec> list = new List <BadMessageRec>(1); list.Add(BadMessageRec.Folder(folderRec, badItemKind, ex)); this.reportBadItemsDelegate(list); return(true); } return(false); }); this.hasUnresolvedMappings = true; } }