public void SetExtendedProps(PropTag[] promotedProperties, RestrictionData[] restrictions, SortOrderData[] views, ICSViewData[] icsViews) { MrsTracer.Provider.Function("StorageDestinationFolder.SetExtendedProps: {0}", new object[] { base.DisplayNameForTracing }); if (promotedProperties != null && promotedProperties.Length > 0) { ExecutionContext.Create(new DataContext[] { new OperationDataContext("StorageDestinationFolder.SetPromotedProps", OperationType.None), new PropTagsDataContext(promotedProperties) }).Execute(delegate { PropertyDefinition[] dataColumns = this.Mailbox.ConvertPropTagsToDefinitions(promotedProperties); using (this.Mailbox.RHTracker.Start()) { using (QueryResult queryResult = this.CoreFolder.QueryExecutor.ItemQuery(ItemQueryType.None, null, null, dataColumns)) { this.GetRowsIgnoreKnownFailures(queryResult); } } }); } if (restrictions != null && restrictions.Length > 0) { MrsTracer.Provider.Debug("Applying restrictions.", new object[0]); for (int i = 0; i < restrictions.Length; i++) { RestrictionData rd = restrictions[i]; ExecutionContext.Create(new DataContext[] { new OperationDataContext("StorageDestinationFolder.ApplyRestriction", OperationType.None), new RestrictionDataContext(rd) }).Execute(delegate { QueryFilter queryFilter = rd.GetQueryFilter(this.Mailbox.StoreSession); PropertyDefinition[] dataColumns = new PropertyDefinition[] { CoreObjectSchema.EntryId }; using (this.Mailbox.RHTracker.Start()) { using (new SortLCIDContext(this.Mailbox.StoreSession, rd.LCID)) { using (QueryResult queryResult = this.CoreFolder.QueryExecutor.ItemQuery(ItemQueryType.None, queryFilter, null, dataColumns)) { this.GetRowsIgnoreKnownFailures(queryResult); } } } }); } } if (views != null && views.Length > 0) { MrsTracer.Provider.Debug("Applying views.", new object[0]); for (int j = 0; j < views.Length; j++) { SortOrderData sod = views[j]; if (sod.Members != null && sod.Members.Length != 0) { ExecutionContext.Create(new DataContext[] { new OperationDataContext("StorageDestinationFolder.ApplySortOrder", OperationType.None), new SortOrderDataContext(sod) }).Execute(delegate { List <SortBy> list; List <GroupByAndOrder> list2; int expandCount; this.GetSortBy(sod, out list, out list2, out expandCount); ItemQueryType itemQueryType = ItemQueryType.None; if (sod.FAI) { itemQueryType |= ItemQueryType.Associated; } else if (sod.Conversation) { itemQueryType |= ItemQueryType.ConversationView; } PropertyDefinition[] dataColumns = new PropertyDefinition[] { CoreObjectSchema.EntryId }; using (this.Mailbox.RHTracker.Start()) { using (new SortLCIDContext(this.Mailbox.StoreSession, sod.LCID)) { QueryResult queryResult; if (list2.Count > 0) { queryResult = this.CoreFolder.QueryExecutor.GroupedItemQuery(null, itemQueryType, list2.ToArray(), expandCount, list.ToArray(), dataColumns); } else { queryResult = this.CoreFolder.QueryExecutor.ItemQuery(itemQueryType, null, (list.Count == 0) ? null : list.ToArray(), dataColumns); } using (queryResult) { this.GetRowsIgnoreKnownFailures(queryResult); } } } }); } } } if (icsViews != null && icsViews.Length > 0) { MrsTracer.Provider.Debug("Applying ICS views.", new object[0]); for (int k = 0; k < icsViews.Length; k++) { ICSViewData icsView = icsViews[k]; ExecutionContext.Create(new DataContext[] { new OperationDataContext("StorageDestinationFolder.ApplyICSView", OperationType.None), new ICSViewDataContext(icsView) }).Execute(delegate { using (MailboxSyncProvider mailboxSyncProvider = new MailboxSyncProvider(this.Folder, true, !icsView.Conversation, true, icsView.Conversation, true, false, null)) { mailboxSyncProvider.GetMaxItemWatermark(mailboxSyncProvider.CreateNewWatermark()); } }); } } }
public void SetExtendedProps(PropTag[] promotedProperties, RestrictionData[] restrictions, SortOrderData[] views, ICSViewData[] icsViews) { MrsTracer.Provider.Function("MapiDestinationFolder.SetExtendedProps", new object[0]); if (promotedProperties != null && promotedProperties.Length > 0) { ExecutionContext.Create(new DataContext[] { new OperationDataContext("MapiDestinationFolder.SetPromotedProps", OperationType.None), new PropTagsDataContext(promotedProperties) }).Execute(delegate { using (this.Mailbox.RHTracker.Start()) { using (MapiTable contentsTable = this.Folder.GetContentsTable(ContentsTableFlags.DeferredErrors)) { contentsTable.SetColumns(promotedProperties); contentsTable.QueryRows(1); } } }); } if (restrictions != null && restrictions.Length > 0) { MrsTracer.Provider.Debug("Applying restrictions.", new object[0]); for (int i = 0; i < restrictions.Length; i++) { RestrictionData rd = restrictions[i]; ExecutionContext.Create(new DataContext[] { new OperationDataContext("MapiDestinationFolder.ApplyRestriction", OperationType.None), new RestrictionDataContext(rd) }).Execute(delegate { Restriction native = DataConverter <RestrictionConverter, Restriction, RestrictionData> .GetNative(rd); using (this.Mailbox.RHTracker.Start()) { using (MapiTable contentsTable = this.Folder.GetContentsTable(ContentsTableFlags.DeferredErrors)) { using (new SortLCIDContext(this.Folder.MapiStore, rd.LCID)) { contentsTable.Restrict(native); contentsTable.QueryRows(1); } } } }); } } if (views != null && views.Length > 0) { MrsTracer.Provider.Debug("Applying views.", new object[0]); for (int j = 0; j < views.Length; j++) { SortOrderData sod = views[j]; ExecutionContext.Create(new DataContext[] { new OperationDataContext("MapiDestinationFolder.ApplySortOrder", OperationType.None), new SortOrderDataContext(sod) }).Execute(delegate { SortOrder native = DataConverter <SortOrderConverter, SortOrder, SortOrderData> .GetNative(sod); ContentsTableFlags contentsTableFlags = ContentsTableFlags.DeferredErrors; if (sod.FAI) { contentsTableFlags |= ContentsTableFlags.Associated; } else if (sod.Conversation) { contentsTableFlags |= ContentsTableFlags.ShowConversations; } using (this.Mailbox.RHTracker.Start()) { using (MapiTable contentsTable = this.Folder.GetContentsTable(contentsTableFlags)) { using (new SortLCIDContext(this.Folder.MapiStore, sod.LCID)) { contentsTable.SortTable(native, SortTableFlags.None); contentsTable.QueryRows(1); } } } }); } } if (icsViews != null && icsViews.Length > 0) { MrsTracer.Provider.Debug("Applying ICS views.", new object[0]); for (int k = 0; k < icsViews.Length; k++) { ICSViewData icsView = icsViews[k]; ExecutionContext.Create(new DataContext[] { new OperationDataContext("MapiDestinationFolder.ApplyICSView", OperationType.None), new ICSViewDataContext(icsView) }).Execute(delegate { ManifestConfigFlags flags = ManifestConfigFlags.Associated | ManifestConfigFlags.Normal; if (icsView.Conversation) { flags = ManifestConfigFlags.Conversations; } using (this.Mailbox.RHTracker.Start()) { using (MapiManifest mapiManifest = this.Folder.CreateExportManifest()) { PropTag[] array = Array <PropTag> .Empty; if (icsView.CoveringPropertyTags != null) { array = new PropTag[icsView.CoveringPropertyTags.Length]; for (int l = 0; l < icsView.CoveringPropertyTags.Length; l++) { array[l] = (PropTag)icsView.CoveringPropertyTags[l]; } } mapiManifest.Configure(flags, null, null, MapiDestinationFolder.DummyManifestContentsCallback.Instance, array); while (mapiManifest.Synchronize() != ManifestStatus.Done) { } } } }); } } }
public ICSViewDataContext(ICSViewData icsViewData) { this.icsViewData = icsViewData; }