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; } }
private void LoadFolderHierarchy(StoreObjectId rootFolderId, NativeStorePropertyDefinition[] propertiesToLoad, List <FolderRec> result) { using (CoreFolder coreFolder = CoreFolder.Bind(this.StoreSession, rootFolderId)) { FolderRec folderRec = this.GetFolderRec(coreFolder, propertiesToLoad); if (base.Flags.HasFlag(LocalMailboxFlags.ParallelPublicFolderMigration)) { folderRec.FolderName = "Public Root"; } result.Add(folderRec); using (QueryResult queryResult = coreFolder.QueryExecutor.FolderQuery(FolderQueryFlags.DeepTraversal, null, null, propertiesToLoad)) { object[][] rows; do { using (base.RHTracker.Start()) { rows = queryResult.GetRows(1000); } foreach (object[] values in rows) { FolderRec folderRec2 = FolderRec.Create(this.StoreSession, propertiesToLoad, values); if (folderRec2 != null) { result.Add(folderRec2); } } }while (rows.Length != 0); } } }
void IDestinationMailbox.DeleteFolder(FolderRec folderRec) { MrsTracer.Provider.Function("StorageDestinationMailbox.DeleteFolder(\"{0}\")", new object[] { folderRec.FolderName }); base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None); using (base.RHTracker.Start()) { using (CoreFolder coreFolder = CoreFolder.Bind(base.StoreSession, base.GetFolderId(folderRec.ParentId))) { GroupOperationResult groupOperationResult = coreFolder.DeleteFolder(DeleteFolderFlags.DeleteMessages | DeleteFolderFlags.DeleteSubFolders, StoreObjectId.FromProviderSpecificId(folderRec.EntryId)); if (groupOperationResult.OperationResult != OperationResult.Succeeded) { MrsTracer.Provider.Error("StorageDestinationMailbox.DeleteFolder failed with '{0}'. Folder name: '{1}', type: '{2}', entry id: '{3}'.", new object[] { groupOperationResult.Exception.ToString(), folderRec.FolderName, folderRec.FolderType, TraceUtils.DumpEntryId(folderRec.EntryId) }); groupOperationResult.Exception.PreserveExceptionStack(); throw groupOperationResult.Exception; } } } }
public FolderSizeRecord(FolderRec fRec) { this.FolderId = fRec.EntryId; this.MessageCount = 0; this.TotalMessageSize = 0UL; this.DeletedMessageCount = 0; this.TotalDeletedMessageSize = 0UL; object obj = fRec[PropTag.ContentCount]; if (obj != null) { this.MessageCount += (int)obj; } object obj2 = fRec[PropTag.MessageSizeExtended]; if (obj2 != null) { this.TotalMessageSize += (ulong)((long)obj2); } obj = fRec[PropTag.AssocContentCount]; if (obj != null) { this.MessageCount += (int)obj; } obj2 = fRec[PropTag.AssocMessageSizeExtended]; if (obj2 != null) { this.TotalMessageSize += (ulong)((long)obj2); } }
protected void GetExtendedProps(FolderRec folderRec, GetFolderRecFlags flags) { MrsTracer.Provider.Function("MapiFolder.GetExtendedProps", new object[0]); if ((flags & GetFolderRecFlags.PromotedProperties) != GetFolderRecFlags.None) { PropValue prop; using (this.Mailbox.RHTracker.Start()) { prop = this.Folder.GetProp(PropTag.PromotedProperties); } if (!prop.IsNull() && !prop.IsError()) { PropTag[] array = PropTagHelper.PropTagArray(prop.GetBytes()); folderRec.SetPromotedProperties(array); MrsTracer.Provider.Debug("Found {0} promoted properties.", new object[] { array.Length }); } else { folderRec.SetPromotedProperties(null); MrsTracer.Provider.Debug("Source server does not support promoted property retrieval.", new object[0]); } } if ((flags & (GetFolderRecFlags.Views | GetFolderRecFlags.Restrictions)) != GetFolderRecFlags.None) { this.Mailbox.GetFolderViewsOrRestrictions(folderRec, flags, this.FolderId); } }
public static FolderRec Create(MapiFolder folder, PropTag[] additionalPtagsToLoad) { PropTag[] array; if (additionalPtagsToLoad == null) { array = FolderRec.PtagsToLoad; } else { List <PropTag> list = new List <PropTag>(); list.AddRange(FolderRec.PtagsToLoad); list.AddRange(additionalPtagsToLoad); array = list.ToArray(); } PropValue[] props = folder.GetProps(array); byte[] array2 = null; for (int i = 0; i < array.Length; i++) { PropTag propTag = array[i]; PropTag propTag2 = propTag; if (propTag2 != PropTag.EntryId) { if (propTag2 == PropTag.LTID) { props[i] = new PropValue(PropTag.LTID, folder.MapiStore.GlobalIdFromId(folder.MapiStore.GetFidFromEntryId(array2))); } } else { array2 = (byte[])props[i].Value; } } return(FolderRec.Create(props)); }
private void TranslateParentFolderId(FolderRec folderRec) { if (this.Mailbox.IsPublicFolderMigrationSource && this.Folder.MapiStore != this.Mailbox.MapiStore && folderRec.ParentId != null) { PropTag[] array = new PropTag[] { PropTag.RootEntryId, PropTag.IpmSubtreeEntryId, PropTag.NonIpmSubtreeEntryId, PropTag.EFormsRegistryEntryId, PropTag.LocaleEFormsRegistryEntryId, PropTag.FreeBusyEntryId, PropTag.LocalSiteFreeBusyEntryId, PropTag.OfflineAddressBookEntryId, PropTag.LocalSiteOfflineAddressBookEntryId }; foreach (PropTag tag in array) { if (CommonUtils.IsSameEntryId(folderRec.ParentId, this.Folder.MapiStore.GetProp(tag).GetBytes())) { folderRec.ParentId = this.Mailbox.MapiStore.GetProp(tag).GetBytes(); return; } } } }
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); }
List <FolderRec> IMailbox.EnumerateFolderHierarchy(EnumerateFolderHierarchyFlags flags, PropTag[] additionalPtagsToLoad) { MrsTracer.Provider.Function("ImapMailbox.EnumerateFolderHierarchy({0})", new object[] { flags }); base.VerifyMailboxConnection(VerifyMailboxConnectionFlags.None); List <FolderRec> list = null; List <ImapClientFolder> list2 = this.EnumerateFolderHierarchy(); list2.Add(new ImapClientFolder(ImapMailbox.Root) { IsSelectable = false }); list2.Add(new ImapClientFolder(ImapMailbox.IpmSubtree) { IsSelectable = false }); ImapClientFolder.FindWellKnownFolders(list2); this.folderCache = new EntryIdMap <ImapClientFolder>(); list = new List <FolderRec>(list2.Count); foreach (ImapClientFolder imapClientFolder in list2) { FolderRec folderRec = this.CreateFolderRec(imapClientFolder); list.Add(folderRec); this.folderCache.Add(folderRec.EntryId, imapClientFolder); } return(list); }
private void GetHierarchy(IFolder iFolder, List <FolderRec> hierarchy, PropertyTag[] momtPtagsToLoad) { using (PstFxFolder pstFxFolder = new PstFxFolder(this, iFolder)) { hierarchy.Add(FolderRec.Create(PstMailbox.PvaFromMoMTPva(pstFxFolder.GetProps(momtPtagsToLoad)))); foreach (uint num in iFolder.SubFolderIds) { IFolder folder; try { folder = this.iPst.ReadFolder(num); } catch (PSTIOException innerException) { throw new UnableToReadPSTFolderTransientException(num, innerException); } catch (PSTExceptionBase innerException2) { throw new UnableToReadPSTFolderPermanentException(num, innerException2); } if (folder == null) { MrsTracer.Provider.Error("Pst folder 0x{0:x} does not exist", new object[] { num }); } else { this.GetHierarchy(folder, hierarchy, momtPtagsToLoad); } } } }
void IDestinationMailbox.CreateFolder(FolderRec sourceFolder, CreateFolderFlags createFolderFlags, out byte[] newFolderId) { MrsTracer.ProxyClient.Function("RemoteDestinationMailbox.CreateFolder(\"{0}\")", new object[] { sourceFolder.FolderName }); base.VerifyMailboxConnection(); if (!base.ServerVersion[8]) { if (sourceFolder.EntryId == null) { throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IDestinationMailbox_CreateFolder"); } base.MrsProxy.IDestinationMailbox_CreateFolder(base.Handle, sourceFolder, createFolderFlags.HasFlag(CreateFolderFlags.FailIfExists)); newFolderId = sourceFolder.EntryId; return; } else { if (!base.ServerVersion[50]) { base.MrsProxy.IDestinationMailbox_CreateFolder2(base.Handle, sourceFolder, createFolderFlags.HasFlag(CreateFolderFlags.FailIfExists), out newFolderId); return; } if (createFolderFlags.HasFlag(CreateFolderFlags.CreatePublicFolderDumpster) && !base.ServerVersion[49]) { throw new UnsupportedRemoteServerVersionWithOperationPermanentException(base.MrsProxyClient.ServerName, base.ServerVersion.ToString(), "IDestinationMailbox_CreateFolder with CanStoreCreatePFDumpster"); } base.MrsProxy.IDestinationMailbox_CreateFolder3(base.Handle, sourceFolder, (int)createFolderFlags, out newFolderId); return; } }
internal static BadMessageRec Item(MessageRec msgData, FolderRec folderRec, Exception exception) { BadMessageRec badMessageRec = new BadMessageRec(); if (exception == null) { badMessageRec.Kind = BadItemKind.MissingItem; } else if (CommonUtils.ExceptionIs(exception, new WellKnownException[] { WellKnownException.MapiMaxSubmissionExceeded })) { badMessageRec.Kind = BadItemKind.LargeItem; } else { badMessageRec.Kind = BadItemKind.CorruptItem; } badMessageRec.EntryId = msgData.EntryId; badMessageRec.Sender = (msgData[PropTag.SenderName] as string); badMessageRec.Recipient = (msgData[PropTag.ReceivedByName] as string); badMessageRec.Subject = (msgData[PropTag.Subject] as string); badMessageRec.MessageClass = (msgData[PropTag.MessageClass] as string); badMessageRec.MessageSize = (int?)msgData[PropTag.MessageSize]; badMessageRec.DateSent = (DateTime?)msgData[PropTag.ClientSubmitTime]; badMessageRec.DateReceived = (DateTime?)msgData[PropTag.MessageDeliveryTime]; badMessageRec.FolderId = msgData.FolderId; badMessageRec.FolderName = folderRec.FolderName; badMessageRec.Failure = FailureRec.Create(exception); badMessageRec.RawFailure = exception; return(badMessageRec); }
FolderRec IFolder.GetFolderRec(PropTag[] additionalPtagsToLoad, GetFolderRecFlags flags) { if (this.folderRec != null) { return(this.folderRec); } PropTag[] pta; if (additionalPtagsToLoad != null) { List <PropTag> list = new List <PropTag>(); list.AddRange(FolderRec.PtagsToLoad); list.AddRange(additionalPtagsToLoad); pta = list.ToArray(); } else { pta = FolderRec.PtagsToLoad; } PropertyValue[] momtPva = null; try { momtPva = this.folder.GetProps(PstMailbox.MoMTPtaFromPta(pta)); } catch (PSTIOException innerException) { throw new UnableToGetPSTFolderPropsTransientException(BitConverter.ToUInt32(this.folderId, 0), innerException); } catch (PSTExceptionBase innerException2) { uint nodeIdFromEntryId = PstMailbox.GetNodeIdFromEntryId(this.folder.PstMailbox.IPst.MessageStore.Guid, this.folderId); throw new UnableToGetPSTFolderPropsPermanentException(nodeIdFromEntryId, innerException2); } this.folderRec = FolderRec.Create(PstMailbox.PvaFromMoMTPva(momtPva)); return(this.folderRec); }
protected override StorageFxProxyPool.FolderEntry CreateFolder(FolderRec folderRec) { IDestinationMailbox destinationMailbox = this.destMailbox; byte[] folderID; destinationMailbox.CreateFolder(folderRec, CreateFolderFlags.None, out folderID); return(this.OpenFolder(folderID)); }
public FxProxyPoolCreateFolderMessage(byte[] blob) { FolderRec folderRec = CommonUtils.DataContractDeserialize <FolderRec>(blob); if (folderRec != null) { this.Data = folderRec; } }
void IDestinationMailbox.DeleteFolder(FolderRec folderRec) { MrsTracer.ProxyClient.Function("RemoteDestinationMailbox.DeleteFolder(\"{0}\")", new object[] { folderRec.FolderName }); base.VerifyMailboxConnection(); base.MrsProxy.IDestinationMailbox_DeleteFolder(base.Handle, folderRec); }
IFolderProxy IFxProxyPool.CreateFolder(FolderRec folderRec) { TFolderEntry tfolderEntry = this.OpenFolder(folderRec.EntryId); if (tfolderEntry == null) { tfolderEntry = this.CreateFolder(folderRec); } return(new FxProxyPool <TFolderEntry, TMessageEntry> .FolderProxy(tfolderEntry, this)); }
IFolderProxy IFxProxyPool.CreateFolder(FolderRec folder) { IFolderProxy proxy = null; using (base.CreateCostHandle()) { proxy = base.WrappedObject.CreateFolder(folder); } return(new FxProxyPoolBudgetWrapper.FolderProxyBudgetWrapper(proxy, true, base.CreateCostHandle, base.Charge)); }
void IDestinationMailbox.DeleteFolder(FolderRec folderRec) { base.CreateContext("IDestinationMailbox.DeleteFolder", new DataContext[] { new FolderRecDataContext(folderRec) }).Execute(delegate { ((IDestinationMailbox)this.WrappedObject).DeleteFolder(folderRec); }, true); }
private FolderRec GetFolderRec(CoreFolder folder, NativeStorePropertyDefinition[] propertiesToLoad) { folder.PropertyBag.Load(propertiesToLoad); object[] array = new object[propertiesToLoad.Length]; for (int i = 0; i < propertiesToLoad.Length; i++) { array[i] = folder.PropertyBag.TryGetProperty(propertiesToLoad[i]); } return(FolderRec.Create(this.StoreSession, propertiesToLoad, array)); }
internal static BadMessageRec MisplacedFolder(FolderRec folderRec, string folderPath, WellKnownFolderType wkfType, byte[] destParentId) { return(new BadMessageRec { Kind = BadItemKind.MisplacedFolder, EntryId = BadMessageRec.ComputeKey(folderRec.EntryId, BadItemKind.MisplacedFolder), FolderId = folderRec.EntryId, FolderName = folderPath, WellKnownFolderType = wkfType }); }
internal ContentChangeResult VerifyContentsChanged(FolderRec folderRec) { if (this.State.HasFlag(FolderState.IsGhosted)) { return(ContentChangeResult.Ghosted); } if (!this.IsFolderChanged(folderRec, this.LocalCommitTimeMax)) { return(ContentChangeResult.NotChanged); } return(ContentChangeResult.Changed); }
internal static BadMessageRec Folder(FolderRec folderRec, BadItemKind kind, Exception failure) { return(new BadMessageRec { Kind = kind, EntryId = BadMessageRec.ComputeKey(folderRec.EntryId, kind), FolderId = folderRec.EntryId, FolderName = folderRec.FolderName, Failure = FailureRec.Create(failure), RawFailure = failure }); }
List <FolderRec> IMailbox.EnumerateFolderHierarchy(EnumerateFolderHierarchyFlags flags, PropTag[] additionalPtagsToLoad) { MrsTracer.Provider.Function("PstMailbox.IMailbox.EnumerateFolderHierarchy({0})", new object[] { flags }); List <FolderRec> list = new List <FolderRec>(50); List <PropTag> list2 = new List <PropTag>(FolderRec.PtagsToLoad); if (additionalPtagsToLoad != null) { list2.AddRange(additionalPtagsToLoad); } PropertyTag[] array = PstMailbox.MoMTPtaFromPta(list2.ToArray()); try { IFolder folder = this.iPst.ReadFolder(290U); if (folder == null) { throw new UnableToGetPSTHierarchyPermanentException(this.filePath); } using (PstFxFolder pstFxFolder = new PstFxFolder(this, folder)) { list.Add(FolderRec.Create(PstMailbox.PvaFromMoMTPva(pstFxFolder.GetProps(array)))); PropertyValue property = this.MessageStorePropertyBag.GetProperty(PropertyTag.IPMSubtreeFolder); if (property.IsError || ((byte[])property.Value).Length != 24) { throw new UnableToGetPSTHierarchyPermanentException(this.filePath); } uint nodeIdFromEntryId = PstMailbox.GetNodeIdFromEntryId(this.iPst.MessageStore.Guid, (byte[])property.Value, true); IFolder folder2 = this.iPst.ReadFolder(nodeIdFromEntryId); if (folder2 == null) { throw new UnableToGetPSTHierarchyPermanentException(this.filePath); } this.GetHierarchy(folder2, list, array); } } catch (PSTIOException innerException) { throw new UnableToGetPSTHierarchyTransientException(this.filePath, innerException); } catch (PSTExceptionBase innerException2) { throw new UnableToGetPSTHierarchyPermanentException(this.filePath, innerException2); } MrsTracer.Provider.Debug("PST hierarchy contains {0} folders including root", new object[] { list.Count }); return(list); }
IFolderProxy IFxProxyPool.CreateFolder(FolderRec folder) { IFolderProxy result = null; base.CreateContext("IFxProxyPool.CreateFolder", new DataContext[] { new FolderRecDataContext(folder) }).Execute(delegate { result = this.WrappedObject.CreateFolder(folder); }, true); return(new FxProxyPoolWrapper.FolderProxyWrapper(result, base.CreateContext)); }
void IDestinationMailbox.CreateFolder(FolderRec sourceFolder, CreateFolderFlags createFolderFlags, out byte[] newFolderId) { byte[] newFolderIdInt = null; base.CreateContext("IDestinationMailbox.CreateFolder", new DataContext[] { new FolderRecDataContext(sourceFolder), new SimpleValueDataContext("CreateFolderFlags", createFolderFlags) }).Execute(delegate { ((IDestinationMailbox)this.WrappedObject).CreateFolder(sourceFolder, createFolderFlags, out newFolderIdInt); }, true); newFolderId = newFolderIdInt; }
internal static BadMessageRec FolderProperty(FolderRec folderRec, PropTag propTag, string sourceValue, string destValue) { BadMessageRec badMessageRec = new BadMessageRec(); badMessageRec.FolderId = folderRec.EntryId; badMessageRec.FolderName = folderRec.FolderName; badMessageRec.Kind = BadItemKind.FolderPropertyMismatch; badMessageRec.EntryId = BadMessageRec.ComputeKey(folderRec.EntryId, badMessageRec.Kind, propTag); PropertyMismatchException ex = new PropertyMismatchException((uint)propTag, sourceValue, destValue); badMessageRec.Failure = FailureRec.Create(ex); badMessageRec.RawFailure = ex; return(badMessageRec); }
IFolderProxy IFxProxyPool.CreateFolder(FolderRec folder) { this.EnsureFolderDataCached(); this.FlushBufferedOperations(); if (this.folderDataMap == null) { this.folderDataMap = new EntryIdMap <byte[]>(); } if (!this.folderDataMap.ContainsKey(folder.EntryId)) { this.folderDataMap.Add(folder.EntryId, MapiUtils.MapiFolderObjectData); } return(new FxProxyPoolTransmitter.FolderWrapper(folder, this)); }
FolderRec IFolder.GetFolderRec(PropTag[] additionalPtagsToLoad, GetFolderRecFlags flags) { FolderRec result = null; base.CreateContext("IFolder.GetFolderRec", new DataContext[] { new PropTagsDataContext(additionalPtagsToLoad), new SimpleValueDataContext("Flags", flags) }).Execute(delegate { result = this.WrappedObject.GetFolderRec(additionalPtagsToLoad, flags); }, true); return(result); }
public void CopyFrom(FolderRec sourceRec) { this.entryId = sourceRec.EntryId; this.parentId = sourceRec.ParentId; this.folderName = sourceRec.FolderName; this.folderType = sourceRec.folderType; this.folderClass = sourceRec.FolderClass; this.lastModifyTimestamp = sourceRec.LastModifyTimestamp; this.IsGhosted = sourceRec.IsGhosted; this.additionalProps = sourceRec.AdditionalProps; this.promotedProperties = sourceRec.promotedProperties; this.views = sourceRec.Views; this.icsViews = sourceRec.ICSViews; this.restrictions = sourceRec.Restrictions; }