コード例 #1
0
        internal void SaveToMailbox(MapiStore mailbox, int maxMoveHistoryLength)
        {
            MrsTracer.Common.Function("MoveHistoryEntryInternal.SaveToMailbox(maxHistoryLength={0})", new object[]
            {
                maxMoveHistoryLength
            });
            List <byte[]> list = new List <byte[]>();

            using (MapiFolder folder = MapiUtils.OpenFolderUnderRoot(mailbox, MoveHistoryEntryInternal.MHEFolderName, true))
            {
                using (MapiTable contentsTable = folder.GetContentsTable(ContentsTableFlags.DeferredErrors))
                {
                    contentsTable.SortTable(new SortOrder(PropTag.LastModificationTime, SortFlags.Ascend), SortTableFlags.None);
                    PropValue[][] array = MapiUtils.QueryAllRows(contentsTable, null, new PropTag[]
                    {
                        PropTag.EntryId
                    });
                    foreach (PropValue[] array3 in array)
                    {
                        list.Add(array3[0].GetBytes());
                    }
                }
                MrsTracer.Common.Debug("Move history contains {0} items.", new object[]
                {
                    list.Count
                });
                List <byte[]> list2 = new List <byte[]>();
                while (list.Count >= maxMoveHistoryLength && list.Count > 0)
                {
                    list2.Add(list[0]);
                    list.RemoveAt(0);
                }
                if (list2.Count > 0)
                {
                    MrsTracer.Common.Debug("Clearing {0} entries from move history", new object[]
                    {
                        list2.Count
                    });
                    MapiUtils.ProcessMapiCallInBatches <byte[]>(list2.ToArray(), delegate(byte[][] batch)
                    {
                        folder.DeleteMessages(DeleteMessagesFlags.ForceHardDelete, batch);
                    });
                }
            }
            if (maxMoveHistoryLength <= 0)
            {
                MrsTracer.Common.Debug("Move history saving is disabled.", new object[0]);
                return;
            }
            DateTime dateTime = this.TimeTracker.GetTimestamp(RequestJobTimestamp.Creation) ?? DateTime.MinValue;
            string   subject  = string.Format("MoveHistoryEntry {0}", dateTime.ToString());

            byte[] bytes = BitConverter.GetBytes(dateTime.ToBinary());
            MoveObjectInfo <MoveHistoryEntryInternal> moveObjectInfo = new MoveObjectInfo <MoveHistoryEntryInternal>(Guid.Empty, mailbox, null, MoveHistoryEntryInternal.MHEFolderName, MoveHistoryEntryInternal.MHEMessageClass, subject, bytes);

            using (moveObjectInfo)
            {
                moveObjectInfo.SaveObject(this);
            }
        }
コード例 #2
0
 void IDestinationFolder.SetReadFlagsOnMessages(SetReadFlags flags, byte[][] entryIds)
 {
     MapiUtils.ProcessMapiCallInBatches <byte[]>(entryIds, delegate(byte[][] batch)
     {
         using (this.Mailbox.RHTracker.Start())
         {
             this.Folder.SetReadFlags(flags, batch);
         }
     });
 }
コード例 #3
0
 void IFolder.DeleteMessages(byte[][] entryIds)
 {
     MapiUtils.ProcessMapiCallInBatches <byte[]>(entryIds, delegate(byte[][] batch)
     {
         using (this.Mailbox.RHTracker.Start())
         {
             this.Folder.DeleteMessages(DeleteMessagesFlags.ForceHardDelete, batch);
         }
     });
 }
コード例 #4
0
 void IFolder.DeleteMessages(byte[][] entryIds)
 {
     MrsTracer.Provider.Function("StorageFolder.DeleteMessages: {0}", new object[]
     {
         this.DisplayNameForTracing
     });
     MapiUtils.ProcessMapiCallInBatches <byte[]>(entryIds, delegate(byte[][] batch)
     {
         using (this.Mailbox.RHTracker.Start())
         {
             StoreObjectId[] array = new StoreObjectId[batch.Length];
             for (int i = 0; i < batch.Length; i++)
             {
                 array[i] = StoreObjectId.FromProviderSpecificId(batch[i]);
             }
             this.CoreFolder.DeleteItems(DeleteItemFlags.HardDelete, array);
         }
     });
 }
コード例 #5
0
 void IDestinationFolder.SetReadFlagsOnMessages(SetReadFlags flags, byte[][] entryIds)
 {
     MrsTracer.Provider.Function("StorageDestinationFolder.SetReadFlagsOnMessages: {0}", new object[]
     {
         base.DisplayNameForTracing
     });
     MapiUtils.ProcessMapiCallInBatches <byte[]>(entryIds, delegate(byte[][] batch)
     {
         StoreObjectId[] array = new StoreObjectId[batch.Length];
         for (int i = 0; i < batch.Length; i++)
         {
             array[i] = StoreObjectId.FromProviderSpecificId(batch[i]);
         }
         using (this.Mailbox.RHTracker.Start())
         {
             bool flag;
             this.CoreFolder.SetReadFlags((int)flags, array, out flag);
         }
     });
 }
コード例 #6
0
 internal void CopyBatch(IFxProxyPool proxyPool, List <MessageRec> batch)
 {
     StorageSourceFolder.< > c__DisplayClass9 CS$ < > 8__locals1 = new StorageSourceFolder.< > c__DisplayClass9();
     CS$ < > 8__locals1.< > 4__this = this;
     if (batch.Count == 0)
     {
         return;
     }
     byte[][] array = new byte[batch.Count][];
     for (int i = 0; i < batch.Count; i++)
     {
         array[i] = batch[i].EntryId;
     }
     CS$ < > 8__locals1.flags = CopyMessagesFlags.SendEntryId;
     using (IMapiFxProxy destFolderProxy = proxyPool.GetFolderProxy(base.FolderId))
     {
         if (destFolderProxy == null)
         {
             MrsTracer.Provider.Warning("Destination folder {0} does not exist.", new object[]
             {
                 TraceUtils.DumpEntryId(base.FolderId)
             });
         }
         else
         {
             MapiUtils.ProcessMapiCallInBatches <byte[]>(array, delegate(byte[][] smallBatch)
             {
                 using (CS$ < > 8__locals1.< > 4__this.Mailbox.RHTracker.Start())
                 {
                     using (FxProxyBudgetWrapper fxProxyBudgetWrapper = new FxProxyBudgetWrapper(destFolderProxy, false, new Func <IDisposable>(CS$ < > 8__locals1.< > 4__this.Mailbox.RHTracker.StartExclusive), new Action <uint>(CS$ < > 8__locals1.< > 4__this.Mailbox.RHTracker.Charge)))
                     {
                         CS$ < > 8__locals1.< > 4__this.MapiFolder.ExportMessages(fxProxyBudgetWrapper, CS$ < > 8__locals1.flags, smallBatch);
                     }
                 }
             });
         }
     }
 }