AdrEntryData IDataConverter <AdrEntry, AdrEntryData> .GetDataRepresentation(AdrEntry ae) { return(new AdrEntryData { Values = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(ae.Values) }); }
private RuleData(Rule rule) { this.ExecutionSequence = rule.ExecutionSequence; this.Level = rule.Level; this.StateFlags = (uint)rule.StateFlags; this.UserFlags = rule.UserFlags; this.Condition = DataConverter <RestrictionConverter, Restriction, RestrictionData> .GetData(rule.Condition); this.Actions = DataConverter <RuleActionConverter, RuleAction, RuleActionData> .GetData(rule.Actions); this.Name = rule.Name; this.Provider = rule.Provider; this.ProviderData = rule.ProviderData; this.IsExtended = rule.IsExtended; if (rule.IsExtended) { this.ExtraProperties = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(rule.ExtraProperties); return; } if (rule.ExtraProperties != null && rule.ExtraProperties.Length > 0) { MrsTracer.Common.Error("Non-extended rule '{0}' has {1} extra properties", new object[] { rule.Name, rule.ExtraProperties.Length }); } }
PropProblemData[] IFolder.SetProps(PropValueData[] pvda) { PropProblemData[] result = null; PropValue[] native = DataConverter <PropValueConverter, PropValue, PropValueData> .GetNative(pvda); PropValue[] array = new PropValue[native.Length]; for (int i = 0; i < native.Length; i++) { PropTag propTag = native[i].PropTag; object obj = native[i].Value; if (propTag == PropTag.IpmWasteBasketEntryId) { byte[] array2 = obj as byte[]; if (array2 != null) { obj = this.Mailbox.MapiStore.GlobalIdFromId(this.Mailbox.MapiStore.GetFidFromEntryId(array2)); } } array[i] = new PropValue(propTag, obj); } using (this.Mailbox.RHTracker.Start()) { result = DataConverter <PropProblemConverter, PropProblem, PropProblemData> .GetData(this.Folder.SetProps(array)); } return(result); }
internal PropertyRestrictionData(Restriction.PropertyRestriction r) { this.RelOp = (int)r.Op; this.PropTag = (int)r.PropTag; this.MultiValued = r.MultiValued; this.Value = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(r.PropValue); }
public static FolderRec Create(StoreSession storageSession, PropValue[] pva) { byte[] array = null; byte[] array2 = null; FolderType folderType = FolderType.Generic; string text = null; DateTime dateTime = DateTime.MinValue; List <PropValueData> list = new List <PropValueData>(); foreach (PropValue native in pva) { if (!native.IsNull() && !native.IsError()) { PropTag propTag = native.PropTag; if (propTag <= PropTag.EntryId) { if (propTag == PropTag.ParentEntryId) { array2 = native.GetBytes(); goto IL_CD; } if (propTag == PropTag.EntryId) { array = native.GetBytes(); goto IL_CD; } } else { if (propTag == PropTag.DisplayName) { text = native.GetString(); goto IL_CD; } if (propTag == PropTag.LastModificationTime) { dateTime = native.GetDateTime(); goto IL_CD; } if (propTag == PropTag.FolderType) { folderType = (FolderType)native.GetInt(); goto IL_CD; } } list.Add(DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(native)); } IL_CD :; } if (array != null) { FolderRec folderRec = new FolderRec(array, array2, folderType, text, dateTime, (list.Count > 0) ? list.ToArray() : null); if (storageSession != null && folderRec[PropTag.ReplicaList] != null) { folderRec.IsGhosted = !CoreFolder.IsContentAvailable(storageSession, CoreFolder.GetContentMailboxInfo(ReplicaListProperty.GetStringArrayFromBytes((byte[])folderRec[PropTag.ReplicaList]))); } return(folderRec); } return(null); }
internal ContentRestrictionData(Restriction.ContentRestriction r) { this.Flags = (int)r.Flags; this.PropTag = (int)r.PropTag; this.MultiValued = r.MultiValued; this.Value = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(r.PropValue); }
void ISourceFolder.CopyTo(IFxProxy destFxProxy, CopyPropertiesFlags flags, PropTag[] excludeTags) { MrsTracer.ProxyClient.Function("ISourceFolder.CopyTo({0}): {1}", new object[] { flags, base.FolderName }); byte[] objectData = destFxProxy.GetObjectData(); DataExportBatch dataExportBatch; if (base.ServerVersion[30]) { dataExportBatch = base.MrsProxy.ISourceFolder_CopyTo(base.Handle, (int)flags, DataConverter <PropTagConverter, PropTag, int> .GetData(excludeTags), objectData); } else { dataExportBatch = base.MrsProxy.ISourceFolder_Export2(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(excludeTags), objectData); } long dataExportHandle = dataExportBatch.DataExportHandle; using (FxProxyReceiver fxProxyReceiver = new FxProxyReceiver(destFxProxy, false)) { using (BufferedReceiver bufferedReceiver = new BufferedReceiver(fxProxyReceiver, false, base.MrsProxyClient.UseBuffering, base.MrsProxyClient.UseCompression)) { RemoteDataExport.ExportRoutine(base.MrsProxy, dataExportHandle, bufferedReceiver, dataExportBatch, base.MrsProxyClient.UseCompression); } } }
PropValueData[] IFolder.GetProps(PropTag[] pta) { PropValueData[] data; using (this.Mailbox.RHTracker.Start()) { data = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(this.Folder.GetProps(pta)); } return(data); }
List <MessageRec> IFolder.LookupMessages(PropTag ptagToLookup, List <byte[]> keysToLookup, PropTag[] additionalPtagsToLoad) { MrsTracer.ProxyClient.Function("IFolder.LookupMessages(): {0}", new object[] { this.FolderName }); if (!base.ServerVersion[16]) { throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IFolder_LookupMessages"); } return(base.MrsProxy.IFolder_LookupMessages(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(ptagToLookup), keysToLookup.ToArray(), DataConverter <PropTagConverter, PropTag, int> .GetData(additionalPtagsToLoad))); }
RuleData[] IFolder.GetRules(PropTag[] extraProps) { MrsTracer.ProxyClient.Function("IFolder.GetRules(): {0}", new object[] { this.FolderName }); if (!base.ServerVersion[8]) { throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IFolder_GetRules"); } return(base.MrsProxy.IFolder_GetRules(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(extraProps))); }
internal CommentRestrictionData(Restriction.CommentRestriction r) { base.ParseRestrictions(new Restriction[] { r.Restriction }); this.PropValues = new PropValueData[r.Values.Length]; for (int i = 0; i < r.Values.Length; i++) { this.PropValues[i] = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(r.Values[i]); } }
PropProblemData[] IDestinationFolder.SetSecurityDescriptor(SecurityProp secProp, RawSecurityDescriptor sd) { if (sd == null || (secProp != SecurityProp.NTSD && base.Mailbox.IsTitanium)) { return(null); } PropProblem[] a; using (base.Mailbox.RHTracker.Start()) { a = base.Folder.SetSecurityDescriptor(secProp, sd); } return(DataConverter <PropProblemConverter, PropProblem, PropProblemData> .GetData(a)); }
PropProblemData[] IDestinationMailbox.SetProps(PropValueData[] pvda) { MrsTracer.Provider.Function("MapiDestinationMailbox.SetProps", new object[0]); base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None); PropValue[] native = DataConverter <PropValueConverter, PropValue, PropValueData> .GetNative(pvda); PropProblemData[] data; using (base.RHTracker.Start()) { data = DataConverter <PropProblemConverter, PropProblem, PropProblemData> .GetData(base.MapiStore.SetProps(native)); } return(data); }
PropValueData[] IMailbox.GetProps(PropTag[] ptags) { MrsTracer.ProxyClient.Function("RemoteMailbox.GetProps", new object[0]); this.VerifyMailboxConnection(); if (base.ServerVersion[8]) { return(base.MrsProxy.IMailbox_GetProps(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(ptags))); } if (this is RemoteSourceMailbox) { return(base.MrsProxy.ISourceMailbox_GetProps(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(ptags))); } throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IMailbox_GetProps"); }
FolderRec IFolder.GetFolderRec(PropTag[] additionalPtagsToLoad, GetFolderRecFlags flags) { if (!base.ServerVersion[15]) { return(base.MrsProxy.IFolder_GetFolderRec2(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(additionalPtagsToLoad))); } FolderRec folderRec = base.MrsProxy.IFolder_GetFolderRec3(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(additionalPtagsToLoad), (int)flags); this.FolderName = folderRec.FolderName; MrsTracer.ProxyClient.Function("IFolder.GetFolderRec(): {0}", new object[] { this.FolderName }); return(folderRec); }
PropValueData[] IFolder.GetProps(PropTag[] pta) { MrsTracer.ProxyClient.Function("IFolder.GetProps(): {0}", new object[] { this.FolderName }); if (base.ServerVersion[8]) { return(base.MrsProxy.IFolder_GetProps(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(pta))); } if (this is RemoteSourceFolder) { return(base.MrsProxy.ISourceFolder_GetProps(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(pta))); } throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IFolder_GetProps"); }
RuleData[] IFolder.GetRules(PropTag[] extraProps) { MrsTracer.Provider.Function("StorageFolder.GetRules: {0}", new object[] { this.DisplayNameForTracing }); if (this.CoreFolder.Id.ObjectId.ObjectType == StoreObjectType.SearchFolder) { return(Array <RuleData> .Empty); } Rule[] rules; using (this.Mailbox.RHTracker.Start()) { rules = this.Folder.MapiFolder.GetRules(extraProps); } return(DataConverter <RuleConverter, Rule, RuleData> .GetData(rules)); }
private void EnumerateMessagesHelper(List <uint> messageIds, PropTag[] additionalPtagsToLoad, List <MessageRec> messageList) { foreach (uint num in messageIds) { IMessage message = null; PropValueData[] additionalProps = null; PropertyValue property = PstFolder.errorPropertyValue; PropertyValue property2 = PstFolder.errorPropertyValue; try { message = this.folder.PstMailbox.IPst.ReadMessage(num); } catch (PSTIOException innerException) { throw new UnableToGetPSTFolderPropsTransientException(BitConverter.ToUInt32(this.folderId, 0), innerException); } catch (PSTExceptionBase pstexceptionBase) { MrsTracer.Provider.Error("PstFolder.EnumerateMessages failed while reading message: {0}", new object[] { pstexceptionBase }); } if (message != null) { using (PSTMessage pstmessage = new PSTMessage(this.folder.PstMailbox, message)) { if (additionalPtagsToLoad != null) { additionalProps = new PropValueData[additionalPtagsToLoad.Length]; PropertyValue[] array = new PropertyValue[additionalPtagsToLoad.Length]; for (int i = 0; i < additionalPtagsToLoad.Length; i++) { array[i] = pstmessage.RawPropertyBag.GetProperty(PstMailbox.MoMTPtagFromPtag(additionalPtagsToLoad[i])); } additionalProps = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(PstMailbox.PvaFromMoMTPva(array)); } property = pstmessage.RawPropertyBag.GetProperty(PropertyTag.CreationTime); property2 = pstmessage.RawPropertyBag.GetProperty(PropertyTag.MessageSize); } } byte[] entryId = PstMailbox.CreateEntryIdFromNodeId(this.folder.PstMailbox.IPst.MessageStore.Guid, num); MessageRec item = new MessageRec(entryId, this.FolderId, property.IsError ? DateTime.MinValue : ((DateTime)((ExDateTime)property.Value)), property2.IsError ? 1000 : ((int)property2.Value), this.folder.PstMailbox.IPst.CheckIfAssociatedMessageId(num) ? MsgRecFlags.Associated : MsgRecFlags.None, additionalProps); messageList.Add(item); } }
PropValueData[][] IFolder.GetACL(SecurityProp secProp) { if (!this.HasSecurityDescriptor(secProp)) { return(null); } if (this.Mailbox.ServerVersion >= Server.E15MinVersion) { MrsTracer.Provider.Warning("MAPI provider does not support GetACL against E15+ mailboxes", new object[0]); return(null); } PropValueData[][] result; using (this.Mailbox.RHTracker.Start()) { using (MapiModifyTable mapiModifyTable = (MapiModifyTable)this.Folder.OpenProperty(PropTag.AclTable, InterfaceIds.IExchangeModifyTable, 0, OpenPropertyFlags.DeferredErrors)) { GetTableFlags getTableFlags = GetTableFlags.DeferredErrors; if (secProp == SecurityProp.FreeBusyNTSD) { getTableFlags |= GetTableFlags.FreeBusy; } using (MapiTable table = mapiModifyTable.GetTable(getTableFlags)) { PropTag[] propTags = new PropTag[] { PropTag.EntryId, PropTag.MemberId, PropTag.MemberRights, PropTag.MemberName }; table.SeekRow(BookMark.Beginning, 0); PropValue[][] array = MapiUtils.QueryAllRows(table, null, propTags); PropValueData[][] array2 = new PropValueData[array.Length][]; int num = 0; foreach (PropValue[] a in array) { array2[num++] = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(a); } result = array2; } } } return(result); }
RuleData[] IFolder.GetRules(PropTag[] extraProps) { if (!this.Folder.IsContentAvailable) { return(Array <RuleData> .Empty); } RuleData[] result; using (this.Mailbox.RHTracker.Start()) { FolderType @int = (FolderType)this.Folder.GetProp(PropTag.FolderType).GetInt(1); if (@int == FolderType.Search) { result = Array <RuleData> .Empty; } else { result = DataConverter <RuleConverter, Rule, RuleData> .GetData(this.Folder.GetRules(extraProps)); } } return(result); }
PropValueData[] IMailbox.GetProps(PropTag[] pta) { MrsTracer.Provider.Function("PstMailbox.IMailbox.GetProps", new object[0]); PropValue[] array = new PropValue[pta.Length]; for (int i = 0; i < pta.Length; i++) { try { array[i] = PstMailbox.PvFromMoMTPv(this.MessageStorePropertyBag.GetProperty(PstMailbox.MoMTPtagFromPtag(pta[i]))); } catch (PSTIOException innerException) { throw new UnableToGetPSTPropsTransientException(this.filePath, innerException); } catch (PSTExceptionBase innerException2) { throw new UnableToGetPSTPropsPermanentException(this.filePath, innerException2); } } return(DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(array)); }
public void CopyMailboxProperties() { MrsTracer.Service.Function("MailboxMerger.CopyMailboxProperties", new object[0]); PropValue[] native = DataConverter <PropValueConverter, PropValue, PropValueData> .GetNative(base.SourceMailbox.GetProps(MailboxMerger.MailboxPtags)); List <PropValue> list = new List <PropValue>(); foreach (PropValue item in native) { if (!item.IsNull() && !item.IsError()) { if (item.PropTag == PropTag.SentMailEntryId) { byte[] array2 = item.Value as byte[]; if (array2 != null) { FolderMapping folderMapping = this.SourceHierarchy[array2] as FolderMapping; if (folderMapping != null && folderMapping.IsIncluded && folderMapping.TargetFolder != null) { MrsTracer.Service.Debug("Remapped SentItemsEntryId from {0} to {1}", new object[] { TraceUtils.DumpEntryId(array2), TraceUtils.DumpEntryId(folderMapping.TargetFolder.EntryId) }); list.Add(new PropValue(item.PropTag, folderMapping.TargetFolder.EntryId)); } } } else { list.Add(item); } } } if (list.Count > 0) { base.DestMailbox.SetProps(DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(list.ToArray())); } }
void IFolder.GetSearchCriteria(out RestrictionData restriction, out byte[][] entryIds, out SearchState state) { MrsTracer.Provider.Function("MapiFolder.GetSearchCriteria", new object[0]); try { Restriction native; using (this.Mailbox.RHTracker.Start()) { this.Folder.GetSearchCriteria(out native, out entryIds, out state); } restriction = DataConverter <RestrictionConverter, Restriction, RestrictionData> .GetData(native); } catch (MapiExceptionNotInitialized ex) { MrsTracer.Provider.Warning("GetSearchCriteria failed with ecNotInitialized, ignoring.\n{0}", new object[] { CommonUtils.FullExceptionMessage(ex) }); restriction = null; entryIds = null; state = SearchState.None; } }
List <MessageRec> IFolder.LookupMessages(PropTag ptagToLookup, List <byte[]> keysToLookup, PropTag[] additionalPtagsToLoad) { EntryIdMap <MessageRec> result = new EntryIdMap <MessageRec>(); ContentsTableFlags[] array = new ContentsTableFlags[] { ContentsTableFlags.None, ContentsTableFlags.Associated }; List <PropTag> pta = new List <PropTag>(5); int idxEntryId = pta.Count; pta.Add(PropTag.EntryId); int idxMessageSize = pta.Count; pta.Add(PropTag.MessageSize); int idxCreationTime = pta.Count; pta.Add(PropTag.CreationTime); int idxExtraPtags = pta.Count; if (additionalPtagsToLoad != null) { pta.AddRange(additionalPtagsToLoad); } for (int i = 0; i < array.Length; i++) { if (result.Count >= keysToLookup.Count) { break; } ContentsTableFlags flags = ContentsTableFlags.DeferredErrors | array[i]; bool doingFAI = (flags & ContentsTableFlags.Associated) != ContentsTableFlags.None; ExecutionContext.Create(new DataContext[] { new OperationDataContext("MapiFolder.GetContentsTable", OperationType.None), new SimpleValueDataContext("Flags", flags) }).Execute(delegate { MapiTable msgTable; using (this.Mailbox.RHTracker.Start()) { msgTable = this.Folder.GetContentsTable(flags); } using (msgTable) { if (ptagToLookup != PropTag.EntryId) { using (this.Mailbox.RHTracker.Start()) { msgTable.SortTable(new SortOrder(ptagToLookup, SortFlags.Ascend), SortTableFlags.None); } } msgTable.SetColumns(pta); using (List <byte[]> .Enumerator enumerator = keysToLookup.GetEnumerator()) { while (enumerator.MoveNext()) { byte[] key = enumerator.Current; if (!result.ContainsKey(key)) { ExecutionContext.Create(new DataContext[] { new EntryIDsDataContext(key) }).Execute(delegate { try { using (this.Mailbox.RHTracker.Start()) { if (!msgTable.FindRow(Restriction.EQ(ptagToLookup, key), BookMark.Beginning, FindRowFlag.None)) { return; } } } catch (MapiExceptionNotFound) { return; } PropValue[][] array2; using (this.Mailbox.RHTracker.Start()) { array2 = msgTable.QueryRows(1); } if (array2.Length == 1) { PropValue[] array3 = array2[0]; if (array3.Length != pta.Count) { return; } PropValueData[] array4 = null; if (additionalPtagsToLoad != null && additionalPtagsToLoad.Length > 0) { array4 = new PropValueData[additionalPtagsToLoad.Length]; for (int j = idxExtraPtags; j < array3.Length; j++) { array4[j - idxExtraPtags] = DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(array3[j]); } } MessageRec value = new MessageRec(array3[idxEntryId].GetBytes(), this.FolderId, MapiUtils.GetDateTimeOrDefault(array3[idxCreationTime]), array3[idxMessageSize].GetInt(1000), doingFAI ? MsgRecFlags.Associated : MsgRecFlags.None, array4); result.Add(key, value); return; } }); } } } } }); } MrsTracer.Provider.Debug("MapiFolder.LookupMessages returns {0} items.", new object[] { result.Count }); return(new List <MessageRec>(result.Values)); }
List <MessageRec> IFolder.EnumerateMessages(EnumerateMessagesFlags emFlags, PropTag[] additionalPtagsToLoad) { MrsTracer.ProxyClient.Function("IFolder.EnumerateMessages(): {0}", new object[] { this.FolderName }); bool flag; List <MessageRec> list = base.MrsProxy.IFolder_EnumerateMessagesPaged2(base.Handle, emFlags, DataConverter <PropTagConverter, PropTag, int> .GetData(additionalPtagsToLoad), out flag); while (flag) { List <MessageRec> collection = base.MrsProxy.IFolder_EnumerateMessagesNextBatch(base.Handle, out flag); list.AddRange(collection); } foreach (MessageRec messageRec in list) { messageRec.FolderId = this.folderId; } MrsTracer.ProxyClient.Debug("IFolder.EnumerateMessages(): {0} returned {1} messages", new object[] { this.FolderName, list.Count }); return(list); }
NamedPropData[] IMailbox.GetNamesFromIDs(PropTag[] pta) { MrsTracer.ProxyClient.Function("RemoteMailbox.GetNamesFromIDs", new object[0]); this.VerifyMailboxConnection(); return(base.MrsProxy.IMailbox_GetNamesFromIDs(base.Handle, DataConverter <PropTagConverter, PropTag, int> .GetData(pta))); }
List <FolderRec> IMailbox.EnumerateFolderHierarchy(EnumerateFolderHierarchyFlags flags, PropTag[] additionalPtagsToLoad) { MrsTracer.ProxyClient.Function("RemoteMailbox.EnumerateFolderHierarchy({0})", new object[] { flags }); this.VerifyMailboxConnection(); bool flag; List <FolderRec> list = base.MrsProxy.IMailbox_EnumerateFolderHierarchyPaged2(base.Handle, flags, DataConverter <PropTagConverter, PropTag, int> .GetData(additionalPtagsToLoad), out flag); while (flag) { List <FolderRec> collection = base.MrsProxy.IMailbox_EnumerateFolderHierarchyNextBatch(base.Handle, out flag); list.AddRange(collection); } return(list); }
public void SetPromotedProperties(PropTag[] properties) { this.promotedProperties = DataConverter <PropTagConverter, PropTag, int> .GetData(properties); }
public RuleActionFwdDelegateData(RuleAction.FwdDelegate ruleAction, uint flags) : base(ruleAction) { this.Recipients = DataConverter <AdrEntryConverter, AdrEntry, AdrEntryData> .GetData(ruleAction.Recipients); this.Flags = flags; }
List <MessageRec> IFolder.EnumerateMessages(EnumerateMessagesFlags emFlags, PropTag[] additionalPtagsToLoad) { List <MessageRec> result = new List <MessageRec>(); if (!this.Folder.IsContentAvailable) { return(result); } ContentsTableFlags[] array = new ContentsTableFlags[] { ContentsTableFlags.None, ContentsTableFlags.Associated, ContentsTableFlags.ShowSoftDeletes, ContentsTableFlags.ShowSoftDeletes | ContentsTableFlags.Associated }; ContentsTableFlags[] array2 = new ContentsTableFlags[] { ContentsTableFlags.None, ContentsTableFlags.Associated }; ContentsTableFlags[] array3 = (this.Folder.MapiStore.VersionMajor < 15) ? array : array2; for (int i = 0; i < array3.Length; i++) { ContentsTableFlags flags = ContentsTableFlags.DeferredErrors | array3[i]; bool doingFAI = (flags & ContentsTableFlags.Associated) != ContentsTableFlags.None; bool doingDeletes = (flags & ContentsTableFlags.ShowSoftDeletes) != ContentsTableFlags.None; if ((emFlags & ((!doingDeletes || 2 != 0) ? EnumerateMessagesFlags.RegularMessages : ((EnumerateMessagesFlags)0))) != (EnumerateMessagesFlags)0) { List <PropTag> pta = new List <PropTag>(5); int idxEntryId = -1; int idxCreationTime = -1; int idxMessageClass = -1; int idxRuleMsgVersion = -1; int idxMessageSize = -1; idxEntryId = pta.Count; pta.Add(PropTag.EntryId); if ((emFlags & EnumerateMessagesFlags.IncludeExtendedData) != (EnumerateMessagesFlags)0) { idxMessageSize = pta.Count; pta.Add(PropTag.MessageSize); idxCreationTime = pta.Count; pta.Add(PropTag.CreationTime); } if (doingFAI) { idxMessageClass = pta.Count; pta.Add(PropTag.MessageClass); idxRuleMsgVersion = pta.Count; pta.Add(PropTag.RuleMsgVersion); } int idxExtraPtags = pta.Count; if (additionalPtagsToLoad != null) { pta.AddRange(additionalPtagsToLoad); } MrsTracer.Provider.Debug("MapiFolder.GetContentsTable({0})", new object[] { flags }); ExecutionContext.Create(new DataContext[] { new OperationDataContext("MapiFolder.GetContentsTable", OperationType.None), new SimpleValueDataContext("Flags", flags) }).Execute(delegate { int lcidValue = (!doingFAI && this.contentsRestriction != null) ? this.contentsRestriction.LCID : 0; MapiTable contentsTable; using (this.Mailbox.RHTracker.Start()) { contentsTable = this.Folder.GetContentsTable(flags); } using (contentsTable) { using (new SortLCIDContext(this.Folder.MapiStore, lcidValue)) { Restriction restriction = null; if (!doingFAI && this.contentsRestriction != null) { restriction = DataConverter <RestrictionConverter, Restriction, RestrictionData> .GetNative(this.contentsRestriction); } MapiUtils.InitQueryAllRows(contentsTable, restriction, pta); for (;;) { PropValue[][] array4; using (this.Mailbox.RHTracker.Start()) { array4 = contentsTable.QueryRows(1000); } if (array4.GetLength(0) == 0) { break; } MrsTracer.Provider.Debug("QueryRows returned {0} items.", new object[] { array4.Length }); PropValue[][] array5 = array4; int j = 0; while (j < array5.Length) { PropValue[] array6 = array5[j]; if (!doingFAI) { goto IL_1F9; } string @string = array6[idxMessageClass].GetString(); if ((this.Mailbox.Options & MailboxOptions.IgnoreExtendedRuleFAIs) != MailboxOptions.None) { if (!StringComparer.OrdinalIgnoreCase.Equals(@string, "IPM.Rule.Message") && !StringComparer.OrdinalIgnoreCase.Equals(@string, "IPM.Rule.Version2.Message")) { if (!StringComparer.OrdinalIgnoreCase.Equals(@string, "IPM.ExtendedRule.Message")) { goto IL_1F9; } } } else if (!StringComparer.OrdinalIgnoreCase.Equals(@string, "IPM.Rule.Message") || array6[idxRuleMsgVersion].GetInt(0) != 1) { goto IL_1F9; } IL_423: j++; continue; IL_1F9: DateTime dateTime = (idxCreationTime != -1) ? MapiUtils.GetDateTimeOrDefault(array6[idxCreationTime]) : DateTime.MinValue; byte[] bytes = array6[idxEntryId].GetBytes(); if (emFlags.HasFlag(EnumerateMessagesFlags.SkipICSMidSetMissing) && bytes != null && this.Mailbox.SupportsSavingSyncState) { SyncContentsManifestState syncContentsManifestState = this.Mailbox.SyncState[this.FolderId]; if (syncContentsManifestState != null && !syncContentsManifestState.IdSetGivenContainsEntryId(bytes)) { MrsTracer.Provider.Debug("entry id {0} with creation time {1} not found in given items.", new object[] { TraceUtils.DumpEntryId(bytes), dateTime }); goto IL_423; } } List <PropValueData> list = null; if (additionalPtagsToLoad != null && additionalPtagsToLoad.Length > 0) { list = new List <PropValueData>(); for (int k = idxExtraPtags; k < array6.Length; k++) { list.Add(DataConverter <PropValueConverter, PropValue, PropValueData> .GetData(array6[k])); } } if ((emFlags & EnumerateMessagesFlags.ReturnLongTermIDs) == EnumerateMessagesFlags.ReturnLongTermIDs && bytes != null) { if (list == null) { list = new List <PropValueData>(); } list.Add(new PropValueData(PropTag.LTID, this.Mailbox.MapiStore.GlobalIdFromId(this.Mailbox.MapiStore.GetMidFromMessageEntryId(bytes)))); } MsgRecFlags msgRecFlags = doingFAI ? MsgRecFlags.Associated : MsgRecFlags.None; if (doingDeletes) { msgRecFlags |= MsgRecFlags.Deleted; } MessageRec item = new MessageRec(bytes, this.FolderId, dateTime, (idxMessageSize != -1) ? array6[idxMessageSize].GetInt(1000) : 1000, msgRecFlags, (list == null) ? null : list.ToArray()); result.Add(item); goto IL_423; } } } } }); } } MrsTracer.Provider.Debug("MapiFolder.EnumerateMessages returns {0} items.", new object[] { result.Count }); return(result); }