internal static void ContentMailboxInfoSetter(object value, IPropertyBag propertyBag) { propertyBag[PublicFolderSchema.ReplicaListBinary] = ((value != null) ? ReplicaListProperty.GetBytesFromStringArray(new string[] { ((PublicFolderContentMailboxInfo)value).ToString() }) : null); }
protected override FolderRecWrapper CreateDestinationFolder(SyncContext syncContext, FolderRecWrapper srcFolderRec, FolderRecWrapper destParentRec) { CreateFolderFlags createFolderFlags = CreateFolderFlags.None; if (base.IsRoot && base.IsPublicFolderMigration && base.DestMailbox.IsCapabilitySupported(MRSProxyCapabilities.CanStoreCreatePFDumpster)) { createFolderFlags = CreateFolderFlags.CreatePublicFolderDumpster; } byte[] entryId; this.CreateFolder(PublicFolderMigrator.dummyEnumFolderContext, srcFolderRec, createFolderFlags, out entryId); FolderRecWrapper folderRecWrapper = syncContext.CreateTargetFolderRec(srcFolderRec); folderRecWrapper.FolderRec.EntryId = entryId; folderRecWrapper.FolderRec.ParentId = destParentRec.EntryId; List <PropValueData> list = new List <PropValueData>(folderRecWrapper.FolderRec.AdditionalProps); list.Add(new PropValueData(PropTag.ReplicaList, ReplicaListProperty.GetBytesFromStringArray(new string[] { this.GetContentMailboxGuid(srcFolderRec).ToString() }))); folderRecWrapper.FolderRec.AdditionalProps = list.ToArray(); return(folderRecWrapper); }
private void CreateDumpsterFoldersForWellKnownFolders() { FolderHierarchy folderHierarchy = base.DestMailboxWrapper.FolderMap as FolderHierarchy; foreach (FolderMapping folderMapping in new List <FolderMapping>(8) { folderHierarchy.GetWellKnownFolder(WellKnownFolderType.Root), folderHierarchy.GetWellKnownFolder(WellKnownFolderType.IpmSubtree), folderHierarchy.GetWellKnownFolder(WellKnownFolderType.NonIpmSubtree), folderHierarchy.GetWellKnownFolder(WellKnownFolderType.EFormsRegistry), folderHierarchy.GetWellKnownFolder(WellKnownFolderType.PublicFolderDumpsterRoot), folderHierarchy.GetWellKnownFolder(WellKnownFolderType.PublicFolderTombstonesRoot), folderHierarchy.GetWellKnownFolder(WellKnownFolderType.PublicFolderAsyncDeleteState), folderHierarchy.GetWellKnownFolder(WellKnownFolderType.PublicFolderInternalSubmission) }) { List <PropValueData> list = new List <PropValueData>(2); using (IDestinationFolder folder = base.DestMailbox.GetFolder(folderMapping.EntryId)) { if (folder == null) { MrsTracer.Service.Error("Something deleted destination folder from under us", new object[0]); throw new UnexpectedErrorPermanentException(-2147221238); } if (!this.AssociatedDumpsterExists(folder)) { byte[] value = this.CreateAssociatedDumpsterFolder(folderMapping.FolderName, ReplicaListProperty.GetBytesFromStringArray(new string[] { base.TargetMailboxGuid.ToString() }), folderMapping.EntryId); list.Add(new PropValueData(PropTag.IpmWasteBasketEntryId, value)); folder.SetProps(list.ToArray()); } } } }
public override void CreateFolder(FolderMap.EnumFolderContext context, FolderRecWrapper sourceFolderRecWrapper, CreateFolderFlags createFolderFlags, out byte[] newFolderEntryId) { if (sourceFolderRecWrapper.IsInternalAccess) { throw new InternalAccessFolderCreationIsNotSupportedException(); } newFolderEntryId = null; FolderMapping folderMapping = sourceFolderRecWrapper as FolderMapping; FolderHierarchy folderHierarchy = base.DestMailboxWrapper.FolderMap as FolderHierarchy; byte[] sessionSpecificEntryId = base.DestMailbox.GetSessionSpecificEntryId(folderMapping.EntryId); FolderMapping folderMapping2 = folderMapping.Parent as FolderMapping; bool isRoot = base.IsRoot; byte[] parentId; switch (folderMapping2.WKFType) { case WellKnownFolderType.Root: case WellKnownFolderType.NonIpmSubtree: case WellKnownFolderType.IpmSubtree: case WellKnownFolderType.EFormsRegistry: parentId = folderHierarchy.GetWellKnownFolder(folderMapping2.WKFType).EntryId; break; default: if (isRoot || this.ShouldCreateUnderParentInSecondary()) { parentId = base.DestMailbox.GetSessionSpecificEntryId(folderMapping.ParentId); } else { parentId = folderHierarchy.GetWellKnownFolder(WellKnownFolderType.IpmSubtree).EntryId; } break; } byte[] entryId = folderMapping.FolderRec.EntryId; byte[] parentId2 = folderMapping.FolderRec.ParentId; folderMapping.FolderRec.EntryId = sessionSpecificEntryId; folderMapping.FolderRec.ParentId = parentId; base.DestMailbox.CreateFolder(folderMapping.FolderRec, createFolderFlags, out newFolderEntryId); folderMapping.FolderRec.EntryId = entryId; folderMapping.FolderRec.ParentId = parentId2; List <PropValueData> list = new List <PropValueData>(2); Guid contentMailboxGuid = this.GetContentMailboxGuid(sourceFolderRecWrapper); StorePropertyDefinition replicaList = CoreFolderSchema.ReplicaList; byte[] bytesFromStringArray = ReplicaListProperty.GetBytesFromStringArray(new string[] { contentMailboxGuid.ToString() }); list.Add(new PropValueData(PropTag.ReplicaList, bytesFromStringArray)); using (IDestinationFolder folder = base.DestMailbox.GetFolder(sessionSpecificEntryId)) { if (folder == null) { MrsTracer.Service.Error("Something deleted destination folder from under us", new object[0]); throw new UnexpectedErrorPermanentException(-2147221238); } if (isRoot && !this.AssociatedDumpsterExists(folder)) { byte[] value = this.CreateAssociatedDumpsterFolder(folderMapping.FolderName, bytesFromStringArray, sessionSpecificEntryId); list.Add(new PropValueData(PropTag.IpmWasteBasketEntryId, value)); } folder.SetProps(list.ToArray()); } }