// Token: 0x0600053A RID: 1338 RVA: 0x000278A8 File Offset: 0x00025AA8 public Dictionary <StoreObjectId, FolderTuple> GetFolderHierarchyInArchive() { Dictionary <StoreObjectId, FolderTuple> dictionary = new Dictionary <StoreObjectId, FolderTuple>(); try { BaseFolderType folderById = this.ArchiveEwsClient.GetFolderById(new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.archivemsgfolderroot }, this.FolderAllProperties.ToArray()); FolderTupleRemoteArchive folderTupleRemoteArchive = new FolderTupleRemoteArchive(folderById, folderById.FolderId, folderById.ParentFolderId, folderById.DisplayName, RemoteArchiveProcessorBase.ConvertToFolderProperties(folderById.ExtendedProperty), true); dictionary.Add(folderTupleRemoteArchive.FolderId, folderTupleRemoteArchive); IEnumerable <BaseFolderType> folderHierarchy = this.ArchiveEwsClient.GetFolderHierarchy(new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.archivemsgfolderroot }, true, this.folderAllProperties.ToArray()); foreach (BaseFolderType baseFolderType in folderHierarchy) { FolderTupleRemoteArchive folderTupleRemoteArchive2 = new FolderTupleRemoteArchive(baseFolderType, baseFolderType.FolderId, baseFolderType.ParentFolderId, baseFolderType.DisplayName, RemoteArchiveProcessorBase.ConvertToFolderProperties(baseFolderType.ExtendedProperty)); dictionary.Add(folderTupleRemoteArchive2.FolderId, folderTupleRemoteArchive2); } } catch (ElcEwsException arg) { RemoteArchiveProcessorBase.Tracer.TraceError <MailboxSession, ElcEwsException>((long)this.GetHashCode(), "Get folder hierarchy from archive for {0} failed, Exception: {1}", this.primaryMailboxSession, arg); throw; } return(dictionary); }
private BaseFolderType GetWorkingFolder() { BaseFolderIdType parentFolderId = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.msgfolderroot, Mailbox = new EmailAddressType { EmailAddress = this.targetPrimarySmtpAddress } }; string text = this.IsUnsearchable ? (this.workingLocation + ".unsearchable") : this.workingLocation; BaseFolderType baseFolderType = this.ewsClient.GetFolderByName(this.targetPrimarySmtpAddress, parentFolderId, text); if (baseFolderType == null) { FolderType folderType = new FolderType { DisplayName = text }; folderType.ExtendedProperty = new ExtendedPropertyType[] { MailboxItemIdList.IsHiddenExtendedProperty }; List <BaseFolderType> list = this.ewsClient.CreateFolder(this.targetPrimarySmtpAddress, parentFolderId, new BaseFolderType[] { folderType }); baseFolderType = list[0]; } return(baseFolderType); }
public void PreRemoveSearchResults(bool removeLogs) { BaseFolderType orCreateRecycleFolder = this.GetOrCreateRecycleFolder(true); BaseFolderType workingOrResultFolder = this.GetWorkingOrResultFolder(this.targetLocation.ExportLocation); if (workingOrResultFolder != null) { if (removeLogs) { this.ewsClient.MoveFolder(this.PrimarySmtpAddress, orCreateRecycleFolder.FolderId, new BaseFolderIdType[] { workingOrResultFolder.FolderId }); return; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); this.ewsClient.GetAllFolders(this.PrimarySmtpAddress, workingOrResultFolder.FolderId.Id, false, false, dictionary); List <BaseFolderIdType> list = new List <BaseFolderIdType>(dictionary.Count); foreach (KeyValuePair <string, string> keyValuePair in dictionary) { list.Add(new FolderIdType { Id = keyValuePair.Key }); } if (list.Count > 0) { this.ewsClient.MoveFolder(this.PrimarySmtpAddress, orCreateRecycleFolder.FolderId, list.ToArray()); } } }
public void MSOXWSFOLD_S04_TC05_GetNotesFolder() { #region Get the notes folder. DistinguishedFolderIdType folder = new DistinguishedFolderIdType(); folder.Id = DistinguishedFolderIdNameType.notes; // GetFolder request. GetFolderType getNotesFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder); // Get the notes folder. GetFolderResponseType getNotesFolderResponse = this.FOLDAdapter.GetFolder(getNotesFolderRequest); // Check the response. Common.CheckOperationSuccess(getNotesFolderResponse, 1, this.Site); // Variable to save the folder. FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getNotesFolderResponse.ResponseMessages.Items[0]; BaseFolderType folderInfo = (BaseFolderType)allFolders.Folders[0]; #endregion // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R588."); // Verify MS-OXWSFOLD_R588. Site.CaptureRequirementIfAreEqual <string>( "IPF.StickyNote", folderInfo.FolderClass, 588, @"[In t:BaseFolderType Complex Type]This value[FolderClass] MUST be ""IPF.StickyNote"" for note folders."); }
// Token: 0x0600057D RID: 1405 RVA: 0x0002A0C0 File Offset: 0x000282C0 public BaseFolderType CreateFolder(BaseFolderIdType parentFolderId, BaseFolderType newFolder) { CreateFolderType createFolder = new CreateFolderType(); createFolder.Folders = new BaseFolderType[] { newFolder }; createFolder.ParentFolderId = new TargetFolderIdType { Item = parentFolderId }; List <BaseFolderType> newFolders = new List <BaseFolderType>(1); this.CallService(() => this.ServiceBinding.CreateFolder(createFolder), delegate(ResponseMessageType responseMessage, int messageIndex) { if (responseMessage.ResponseClass != ResponseClassType.Error) { FolderInfoResponseMessageType folderInfoResponseMessageType = (FolderInfoResponseMessageType)responseMessage; newFolders.AddRange(folderInfoResponseMessageType.Folders); return(true); } if (responseMessage.ResponseCode == ResponseCodeType.ErrorFolderExists) { throw new ElcEwsException(ElcEwsErrorType.FailedToCreateExistingFolder, responseMessage.ResponseCode.ToString() + " : " + responseMessage.MessageText); } throw new ElcEwsException(ElcEwsErrorType.FailedToCreateFolder, responseMessage.ResponseCode.ToString() + " : " + responseMessage.MessageText); }, (Exception exception) => ElcEwsClient.WrapElcEwsException(ElcEwsErrorType.FailedToCreateFolder, exception)); if (newFolders.Count <= 0) { return(null); } return(newFolders[0]); }
private bool SynchronizeFolder(MailboxSession mailboxSession, LocalFolder localFolder, ItemSynchronizer itemSynchronizer) { BaseFolderType folder = this.GetFolder(mailboxSession, localFolder); this.ActualLevelOfDetails = new SharingLevelOfDetails(folder); this.OriginalLevelOfDetails = new SharingLevelOfDetails(localFolder.LoadLevelOfDetails()); if (this.OriginalLevelOfDetails == LevelOfDetails.None) { SharingEngine.Tracer.TraceDebug <SharingEngine, SharingLevelOfDetails>((long)this.GetHashCode(), "{0}: Access level changed from None to {1}. Saving the actual access level.", this, this.ActualLevelOfDetails); localFolder.SaveLevelOfDetails(this.ActualLevelOfDetails); } if (this.ActualLevelOfDetails == LevelOfDetails.None) { SharingEngine.Tracer.TraceDebug <LocalFolder>((long)this.GetHashCode(), "{0}: Permissions revoked for this folder.", localFolder); localFolder.DeleteAllItems(); localFolder.DeleteSyncState(); localFolder.SaveLevelOfDetails(this.ActualLevelOfDetails); SharingEngine.Tracer.TraceDebug <LocalFolder>((long)this.GetHashCode(), "{0}: All items have been deleted.", localFolder); SharingLog.LogEntry(mailboxSession, "User no longer has permissions to the publisher's folder. All items have been removed."); return(true); } if (this.ActualLevelOfDetails > this.OriginalLevelOfDetails) { SharingEngine.Tracer.TraceDebug <SharingEngine>((long)this.GetHashCode(), "{0}: Permission to the remote folder has increased. Resetting the sync state.", this); this.SyncState = null; localFolder.DeleteSyncState(); } SharingLog.LogEntry(mailboxSession, "Current permissions to the publisher's folder: " + this.ActualLevelOfDetails); return(this.SynchronizeFolderItems(mailboxSession, localFolder, itemSynchronizer)); }
public string CreateResultFolder(string resultFolderName) { BaseFolderType baseFolderType = this.CreateRootResultFolderIfNotExist(); BaseFolderType baseFolderType2 = this.ewsClient.GetFolderByName(this.PrimarySmtpAddress, baseFolderType.FolderId, resultFolderName); if (baseFolderType2 == null) { baseFolderType2 = this.CreateFolder(baseFolderType.FolderId, resultFolderName, false); } return(baseFolderType2.FolderId.Id); }
public void RemoveSearchResults() { this.DeleteWorkingFolders(); BaseFolderType orCreateRecycleFolder = this.GetOrCreateRecycleFolder(false); if (orCreateRecycleFolder == null) { return; } this.ewsClient.DeleteFolder(this.PrimarySmtpAddress, new BaseFolderIdType[] { orCreateRecycleFolder.FolderId }); }
protected override void EndInvoke(IAsyncResult asyncResult) { GetFolderResponseType getFolderResponseType = this.binding.EndGetFolder(asyncResult); if (getFolderResponseType.ResponseMessages == null || getFolderResponseType.ResponseMessages.Items == null) { GetFolderRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: GetFolder web request returned NULL ResponseMessages.", new object[] { TraceContext.Get() }); this.SetErrorResultOnUnexpectedResponse(); return; } FolderInfoResponseMessageType folderInfoResponseMessageType = getFolderResponseType.ResponseMessages.Items[0] as FolderInfoResponseMessageType; if (folderInfoResponseMessageType == null) { GetFolderRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: GetFolder web request returned NULL FolderInfoResponseMessageType.", new object[] { TraceContext.Get() }); this.SetErrorResultOnUnexpectedResponse(); return; } if (folderInfoResponseMessageType.ResponseCode != ResponseCodeType.NoError) { GetFolderRequest.GetFolderRequestTracer.TraceDebug <object, ResponseCodeType>((long)this.GetHashCode(), "{0}: GetFolder web request returned ResponseCodeType {1}.", TraceContext.Get(), folderInfoResponseMessageType.ResponseCode); this.SetErrorResultOnUnexpectedResponse(); return; } if (folderInfoResponseMessageType.Folders == null) { GetFolderRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: GetFolder web request returned NULL Folders.", new object[] { TraceContext.Get() }); this.SetErrorResultOnUnexpectedResponse(); return; } BaseFolderType baseFolderType = folderInfoResponseMessageType.Folders[0]; if (baseFolderType == null) { GetFolderRequest.GetFolderRequestTracer.TraceDebug <object, EmailAddress>((long)this.GetHashCode(), "{0}: GetFolder web request returned NULL FolderResponse for mailbox {1}.", TraceContext.Get(), this.query.Email); this.SetErrorResultOnUnexpectedResponse(); return; } this.ResultFolderId = baseFolderType.FolderId.Id; GetFolderRequest.GetFolderRequestTracer.TraceDebug <object, EmailAddress, string>((long)this.GetHashCode(), "{0}: GetFolder web request returned folder id {2} for mailbox {1}.", TraceContext.Get(), this.query.Email, this.ResultFolderId); }
private void CreateWorkingFolderIfNotExist() { if (!this.Exists) { BaseFolderType[] folders = new BaseFolderType[] { new FolderType { DisplayName = this.sourcePrimarySmtpAddress } }; this.ewsClient.CreateFolder(this.targetPrimarySmtpAddress, this.workingFolder.FolderId, folders); this.PopulateWorkingFolders(); } }
public SharingLevelOfDetails(BaseFolderType folder) { this.currentLevel = LevelOfDetails.Unknown; CalendarFolderType calendarFolderType = folder as CalendarFolderType; if (calendarFolderType == null) { ContactsFolderType contactsFolderType = folder as ContactsFolderType; if (contactsFolderType != null) { switch (contactsFolderType.SharingEffectiveRights) { case PermissionReadAccessType.None: this.currentLevel = LevelOfDetails.None; return; case PermissionReadAccessType.FullDetails: this.currentLevel = LevelOfDetails.Full; break; default: return; } } return; } switch (calendarFolderType.SharingEffectiveRights) { case CalendarPermissionReadAccessType.None: this.currentLevel = LevelOfDetails.None; return; case CalendarPermissionReadAccessType.TimeOnly: this.currentLevel = LevelOfDetails.Availability; return; case CalendarPermissionReadAccessType.TimeAndSubjectAndLocation: this.currentLevel = LevelOfDetails.Limited; return; case CalendarPermissionReadAccessType.FullDetails: this.currentLevel = LevelOfDetails.Full; return; default: return; } }
// Token: 0x06000539 RID: 1337 RVA: 0x0002774C File Offset: 0x0002594C public void MoveToArchiveDumpster(DefaultFolderType folderType, List <ItemData> itemsToMove, ElcSubAssistant assistant, FolderArchiver folderArchiver, int totalFailuresSoFar, ref List <Exception> allExceptionsSoFar, out List <string> foldersWithErrors, out int newMoveErrorsTotal) { if (this.PrimaryEwsClient == null) { throw new ElcEwsException(ElcEwsErrorType.PrimaryExchangeWebServiceNotAvailable, "Primary EWS url is unknown."); } foldersWithErrors = new List <string>(); newMoveErrorsTotal = 0; if (this.IsCrossPremise && this.moveToArchiveTotalCount > this.MoveToArchiveTotalCountLimit) { RemoteArchiveProcessorBase.Tracer.TraceDebug <RemoteArchiveProcessorBase>((long)this.GetHashCode(), "{0}: Move to archive total count limit reached. No more item is moved to the archive mailbox during this run.", this); return; } using (Folder folder = Folder.Bind(this.primaryMailboxSession, folderType)) { DistinguishedFolderIdNameType id; if (RemoteArchiveProcessorBase.ArchiveEwsDumpsterFolderMapping.TryGetValue(folderType, out id)) { BaseFolderType baseFolderType = null; Exception ex = null; try { baseFolderType = this.ArchiveEwsClient.GetFolderById(new DistinguishedFolderIdType { Id = id }, this.FolderAllProperties.ToArray()); } catch (ElcEwsException ex2) { ex = ex2; } if (baseFolderType != null && ex == null) { RemoteArchiveProcessorBase.Tracer.TraceDebug <RemoteArchiveProcessorBase, string, string>((long)this.GetHashCode(), "{0}: Was able to open target folder {1} in the archive, corresponding to source folder {2}. Will proceed to move in batches.", this, baseFolderType.DisplayName, folder.DisplayName); this.MoveItemsInBatches(itemsToMove, folder, baseFolderType, ExpirationExecutor.Action.MoveToArchiveDumpster, totalFailuresSoFar, ref allExceptionsSoFar, out foldersWithErrors, out newMoveErrorsTotal); } else { RemoteArchiveProcessorBase.Tracer.TraceWarning <RemoteArchiveProcessorBase, string, string>((long)this.GetHashCode(), "{0}: Unable to get target folder in the archive corresponding to source folder {1}. Will not move anything to it. Exception : {2}", this, folder.DisplayName, (ex == null) ? string.Empty : ex.ToString()); } } else { RemoteArchiveProcessorBase.Tracer.TraceDebug <RemoteArchiveProcessorBase, DefaultFolderType>((long)this.GetHashCode(), "{0}: Unable to find the corresponding archive dumpster folder for foler type {1}. Will not move anything to it.", this, folderType); } } }
private void InternalCreateOrUpdateSearchLogEmail(MailboxDiscoverySearch searchObject, List <string> successfulMailboxes, List <string> unsuccessfulMailboxes, bool updateIfExists) { BaseFolderType baseFolderType = this.CreateRootResultFolderIfNotExist(); if (string.IsNullOrEmpty(this.logItemId)) { this.logItemId = this.CreateSearchLogEmail(baseFolderType.FolderId, searchObject, successfulMailboxes, unsuccessfulMailboxes); return; } ItemType item = this.ewsClient.GetItem(this.PrimarySmtpAddress, this.logItemId); if (item == null) { this.logItemId = this.CreateSearchLogEmail(baseFolderType.FolderId, searchObject, successfulMailboxes, unsuccessfulMailboxes); return; } this.logItemId = item.ItemId.Id; if (updateIfExists) { ItemChangeType itemChangeType = new ItemChangeType { Item = item.ItemId, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.itemBody }, Item1 = new MessageType { Body = new BodyType { BodyType1 = BodyTypeType.HTML, Value = Util.CreateLogMailBody(searchObject, this.StatusMailRecipients, successfulMailboxes, unsuccessfulMailboxes, this.ExportContext.Sources) } } } } }; this.ewsClient.UpdateItems(this.PrimarySmtpAddress, baseFolderType.FolderId, new ItemChangeType[] { itemChangeType }); } }
public void MSOXWSFOLD_S06_TC06_UpdateDistinguishedFolder() { #region Get the sent items folder. DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.sentitems; // GetFolder request. GetFolderType getSentItemsFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folderId); GetFolderResponseType getSentItemsFolderResponse = this.FOLDAdapter.GetFolder(getSentItemsFolderRequest); // Check the response. Common.CheckOperationSuccess(getSentItemsFolderResponse, 1, this.Site); // Variable to save the folder. FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getSentItemsFolderResponse.ResponseMessages.Items[0]; BaseFolderType folderInfo = (BaseFolderType)allFolders.Folders[0]; #endregion #region Update Folder Operation. // UpdateFolder request to delete folder permission value. UpdateFolderType updateFolderRequest = this.GetUpdateFolderRequest("Folder", "DeleteFolderField", folderInfo.FolderId); // Set change key value. folderId.ChangeKey = folderInfo.FolderId.ChangeKey; updateFolderRequest.FolderChanges[0].Item = folderId; // Update the specific folder's properties. UpdateFolderResponseType updateFolderResponse = this.FOLDAdapter.UpdateFolder(updateFolderRequest); // Check the response. Common.CheckOperationSuccess(updateFolderResponse, 1, this.Site); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R9101"); // Distinguished folder id set and update folder return a successfully, this requirement can be captured. this.Site.CaptureRequirement( 9101, @"[In t:FolderChangeType Complex Type]DistinguishedFolderId specifies an identifier for a distinguished folder."); }
private BaseFolderType CreateRootResultFolderIfNotExist() { BaseFolderType baseFolderType = this.GetWorkingOrResultFolder(this.targetLocation.ExportLocation); if (baseFolderType == null) { DistinguishedFolderIdType parentFolderId = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.msgfolderroot, Mailbox = new EmailAddressType { EmailAddress = this.PrimarySmtpAddress } }; baseFolderType = this.CreateFolder(parentFolderId, this.targetLocation.ExportLocation, false); } return(baseFolderType); }
private BaseFolderType GetOrCreateRecycleFolder(bool createFolderIfNotExist) { DistinguishedFolderIdType folderId = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.root, Mailbox = new EmailAddressType { EmailAddress = this.PrimarySmtpAddress } }; BaseFolderType folderById = this.ewsClient.GetFolderById(this.PrimarySmtpAddress, folderId); BaseFolderType baseFolderType = this.ewsClient.GetFolderByName(this.PrimarySmtpAddress, folderById.FolderId, Constants.MailboxSearchRecycleFolderName); if (baseFolderType == null && createFolderIfNotExist) { baseFolderType = this.CreateFolder(folderById.FolderId, Constants.MailboxSearchRecycleFolderName, true); } return(baseFolderType); }
public void MSOXWSFOLD_S04_TC07_UnReadCount() { #region Get the Inbox folder DistinguishedFolderIdType folder = new DistinguishedFolderIdType(); folder.Id = DistinguishedFolderIdNameType.inbox; // GetFolder request. GetFolderType getInboxRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder); // Get the Inbox folder. GetFolderResponseType getInboxResponse = this.FOLDAdapter.GetFolder(getInboxRequest); // Check the response. Common.CheckOperationSuccess(getInboxResponse, 1, this.Site); // Variable to save the folder. FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getInboxResponse.ResponseMessages.Items[0]; BaseFolderType folderInfo = (BaseFolderType)allFolders.Folders[0]; // Variable to save the count of unread messages before sent mail to the specific account. // Save the unread message count. int count = ((FolderType)folderInfo).UnreadCount; #endregion #region Create an unread message. string itemName = Common.GenerateResourceName(this.Site, "Test Mail"); // Send a mail to User1 ItemIdType itemId = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), DistinguishedFolderIdNameType.inbox.ToString(), itemName); this.NewCreatedItemIds.Add(itemId); #endregion #region Get the Inbox folder // Set the request's folderId field. folder.Id = DistinguishedFolderIdNameType.inbox; // GetFolder request. GetFolderType getInboxAfterMailReceivedRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder); // Get the Inbox folder. GetFolderResponseType getInboxAfterMailReceivedResponse = this.FOLDAdapter.GetFolder(getInboxAfterMailReceivedRequest); // Check the response. Common.CheckOperationSuccess(getInboxAfterMailReceivedResponse, 1, this.Site); // Variable to save the folder. allFolders = (FolderInfoResponseMessageType)getInboxAfterMailReceivedResponse.ResponseMessages.Items[0]; folderInfo = (BaseFolderType)allFolders.Folders[0]; FolderType folderType = (FolderType)folderInfo; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R99"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R99 // Unread count value is returned from server, and schema is verified in adapter so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( folderType.UnreadCount, 99, @"[In t:FolderType Complex Type]The type of element UnreadCount is xs:int [XMLSCHEMA2]."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R10010"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R10010 // After sending a new message to mail box, the number of unread messages should be (count + 1). this.Site.CaptureRequirementIfAreEqual <int>( 1 + count, folderType.UnreadCount, 10010, @"[In t:FolderType Complex Type]This element[UnreadCount] MUST exist in responses."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R9901"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R9901 this.Site.CaptureRequirementIfAreEqual <int>( 1 + count, folderType.UnreadCount, 9901, @"[In t:FolderType Complex Type]UnreadCount specifies the number of unread items in a folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R10011"); // Since R9901 and R100 are captured successfully, this requirement will be captured. this.Site.CaptureRequirement( 10011, @"[In t:FolderType Complex Type]This element[UnreadCount] MUST equal the sum of all MessageType complex types ([MS-OXWSMSG] section 2.2.4.3) and PostItemType complex types ([MS-OXWSPOST] section 2.2.4.1) that have the IsRead property set to ""false""."); }
// Token: 0x0600053C RID: 1340 RVA: 0x00027BA4 File Offset: 0x00025DA4 public FolderTuple CreateAndUpdateFolderInArchive(FolderTuple parentInArchive, FolderTuple sourceInPrimary) { FolderTupleRemoteArchive folderTupleRemoteArchive = (FolderTupleRemoteArchive)parentInArchive; FolderType folderType = new FolderType(); BaseFolderType baseFolderType = null; folderType.DisplayName = sourceInPrimary.DisplayName; List <ExtendedPropertyType> list = new List <ExtendedPropertyType>(); for (FolderHelper.DataColumnIndex dataColumnIndex = FolderHelper.DataColumnIndex.startOfTagPropsIndex; dataColumnIndex <= FolderHelper.DataColumnIndex.containerClassIndex; dataColumnIndex++) { PropertyDefinition key = FolderHelper.DataColumns[(int)dataColumnIndex]; PathToExtendedFieldType pathToExtendedFieldType = this.EwsStorePropertyMapping[key]; object obj = sourceInPrimary.FolderProps[key]; if (obj != null && !(obj is PropertyError)) { obj = ElcEwsClientHelper.ConvertRetentionPropertyForService(obj, pathToExtendedFieldType.PropertyType); ExtendedPropertyType item = new ExtendedPropertyType { ExtendedFieldURI = pathToExtendedFieldType, Item = obj }; list.Add(item); } } if (list.Count > 0) { folderType.ExtendedProperty = list.ToArray(); } try { baseFolderType = this.ArchiveEwsClient.CreateFolder(folderTupleRemoteArchive.EwsFolderId, folderType); } catch (ElcEwsException arg) { RemoteArchiveProcessorBase.Tracer.TraceError <string, MailboxSession, ElcEwsException>((long)this.GetHashCode(), "Create folder {0} in archive for {1} failed, Exception: {2}", sourceInPrimary.DisplayName, this.primaryMailboxSession, arg); throw; } if (baseFolderType != null) { try { baseFolderType = this.ArchiveEwsClient.GetFolderById(baseFolderType.FolderId, this.FolderAllProperties.ToArray()); goto IL_16D; } catch (ElcEwsException arg2) { RemoteArchiveProcessorBase.Tracer.TraceError <string, MailboxSession, ElcEwsException>((long)this.GetHashCode(), "Get newly created folder {0} in archive for {1} failed, Exception: {2}", sourceInPrimary.DisplayName, this.primaryMailboxSession, arg2); throw; } goto IL_13E; IL_16D: if (baseFolderType != null) { return(new FolderTupleRemoteArchive(baseFolderType, baseFolderType.FolderId, folderTupleRemoteArchive.EwsFolderId, baseFolderType.DisplayName, RemoteArchiveProcessorBase.ConvertToFolderProperties(baseFolderType.ExtendedProperty))); } RemoteArchiveProcessorBase.Tracer.TraceError <string, MailboxSession>((long)this.GetHashCode(), "Get newly created folder {0} in archive for {1} returned no folder", sourceInPrimary.DisplayName, this.primaryMailboxSession); throw new ElcEwsException(ElcEwsErrorType.FailedToGetFolderById, "Get newly created folder {0} returned no folder"); } IL_13E: RemoteArchiveProcessorBase.Tracer.TraceError <string, MailboxSession>((long)this.GetHashCode(), "Create folder {0} in archive for {1} returned no folder", sourceInPrimary.DisplayName, this.primaryMailboxSession); throw new ElcEwsException(ElcEwsErrorType.FailedToCreateFolder, "Creating folder {0} returned no folder"); }
// Token: 0x06000540 RID: 1344 RVA: 0x00028004 File Offset: 0x00026204 private void MoveItemsInBatches(List <ItemData> listToSend, Folder sourceFolder, BaseFolderType targetFolder, ExpirationExecutor.Action retentionActionType, int totalFailuresSoFar, ref List <Exception> allExceptionsSoFar, out List <string> foldersWithErrors, out int newMoveErrorsTotal) { foldersWithErrors = new List <string>(); newMoveErrorsTotal = 0; Exception exception = null; int num = 0; long num2 = 0L; foreach (ItemData itemData in listToSend) { if (itemData.MessageSize > this.MaxMessageSizeInArchive) { if (foldersWithErrors.Count == 0) { foldersWithErrors.Add(sourceFolder.DisplayName); RemoteArchiveProcessorBase.Tracer.TraceDebug <RemoteArchiveProcessorBase, string>((long)this.GetHashCode(), "{0}: Added folder {1} to the list of bad folders to be event logged because an item too large was skipped.", this, sourceFolder.DisplayName); } if (this.statisticsLogEntry != null) { this.statisticsLogEntry.NumberOfItemsSkippedDueToSizeRestrictionInArchiveProcessor += 1L; } } else { bool flag = this.ProcessItem(itemData); num++; this.moveToArchiveTotalCount++; num2 += (long)itemData.MessageSize; if (this.IsCrossPremise && this.moveToArchiveTotalCount >= this.MoveToArchiveTotalCountLimit) { if (this.statisticsLogEntry != null) { this.statisticsLogEntry.MoveToArchiveLimitReached = true; break; } break; } else if (flag && !this.ProcessBatch(targetFolder.FolderId, out exception)) { newMoveErrorsTotal++; this.HandleFailure(retentionActionType, sourceFolder, targetFolder, exception, newMoveErrorsTotal + totalFailuresSoFar, ref allExceptionsSoFar); } } } if (!this.ProcessBatch(targetFolder.FolderId, out exception)) { newMoveErrorsTotal++; this.HandleFailure(retentionActionType, sourceFolder, targetFolder, exception, newMoveErrorsTotal + totalFailuresSoFar, ref allExceptionsSoFar); } ELCPerfmon.TotalItemsExpired.IncrementBy((long)num); ELCPerfmon.TotalSizeItemsExpired.IncrementBy(num2); ELCPerfmon.TotalItemsMoved.IncrementBy((long)num); ELCPerfmon.TotalSizeItemsMoved.IncrementBy(num2); }
// Token: 0x06000547 RID: 1351 RVA: 0x00028860 File Offset: 0x00026A60 private void HandleFailure(ExpirationExecutor.Action retentionActionType, Folder sourceFolder, BaseFolderType targetFolder, Exception exception, int failureCount, ref List <Exception> allExceptionsSoFar) { Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_ExpirationOfCurrentBatchFailed, null, new object[] { this.primaryMailboxSession.MailboxOwner, retentionActionType.ToString(), (sourceFolder == null) ? string.Empty : sourceFolder.DisplayName, (targetFolder == null) ? string.Empty : targetFolder.DisplayName, (sourceFolder == null) ? string.Empty : sourceFolder.Id.ObjectId.ToHexEntryId(), (targetFolder == null) ? string.Empty : targetFolder.FolderId.Id, (exception == null) ? string.Empty : exception.ToString() }); if (this.statisticsLogEntry != null) { this.statisticsLogEntry.NumberOfBatchesFailedToMoveInArchiveProcessor += 1L; } if (exception != null) { allExceptionsSoFar.Add(exception); } if (failureCount > MailboxData.MaxErrorsAllowed) { throw new TransientMailboxException(Strings.descELCEnforcerTooManyErrors(this.primaryMailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), MailboxData.MaxErrorsAllowed), new AggregateException(allExceptionsSoFar), null); } }
// Token: 0x06000483 RID: 1155 RVA: 0x00020310 File Offset: 0x0001E510 internal FolderTupleRemoteArchive(BaseFolderType folder, FolderIdType folderId, FolderIdType parentId, string displayName, object[] extendedProps) : base((folderId != null) ? StoreId.EwsIdToStoreObjectId(folderId.Id) : null, (parentId != null) ? StoreId.EwsIdToStoreObjectId(parentId.Id) : null, displayName, extendedProps) { this.ewsFolder = folder; this.ewsFolderId = folderId; this.ewsParentId = parentId; }
// Token: 0x06000484 RID: 1156 RVA: 0x0002035E File Offset: 0x0001E55E internal FolderTupleRemoteArchive(BaseFolderType folder, FolderIdType folderId, FolderIdType parentId, string displayName, object[] extendedProps, bool isRoot) : base(StoreId.EwsIdToStoreObjectId(folderId.Id), StoreId.EwsIdToStoreObjectId(parentId.Id), displayName, extendedProps, isRoot) { this.ewsFolder = folder; this.ewsFolderId = folderId; this.ewsParentId = parentId; }
public void MSOXWSFOLD_S03_TC01_FolderPropertiesAfterMoved() { #region Create two nested folders with an item in the high-level one into the "drafts" folder. // CreateFolder request. CreateFolderType createFolderRequest = this.GetCreateFolderRequest(DistinguishedFolderIdNameType.drafts.ToString(), new string[] { "ForMoveFolder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createFolderResponse = this.FOLDAdapter.CreateFolder(createFolderRequest); // Check the response. Common.CheckOperationSuccess(createFolderResponse, 1, this.Site); FolderIdType newFolderId = ((FolderInfoResponseMessageType)createFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Create a message into this folder string itemName = Common.GenerateResourceName(this.Site, "Test Mail"); ItemIdType itemId = this.CreateItem(Common.GetConfigurationPropertyValue("User1Name", this.Site) + "@" + Common.GetConfigurationPropertyValue("Domain", this.Site), newFolderId.Id, itemName); this.NewCreatedItemIds.Add(itemId); // Create sub folder request. CreateFolderType createSubFolderRequest = this.GetCreateFolderRequest(newFolderId.Id, new string[] { "SubFolder" }, new string[] { "IPF.MyCustomFolderClass" }, null); // Create a new folder. CreateFolderResponseType createNewFolderResponse = this.FOLDAdapter.CreateFolder(createSubFolderRequest); // Check the response. Common.CheckOperationSuccess(createNewFolderResponse, 1, this.Site); FolderIdType subFolderId = ((FolderInfoResponseMessageType)createNewFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(subFolderId); #endregion #region Move the new created folder to the inbox folder // MoveFolder request. MoveFolderType moveFolderRequest = new MoveFolderType(); // Set the request's folderId field. moveFolderRequest.FolderIds = new BaseFolderIdType[1]; moveFolderRequest.FolderIds[0] = newFolderId; // Set the request's destFolderId field. DistinguishedFolderIdType toFolderId = new DistinguishedFolderIdType(); toFolderId.Id = DistinguishedFolderIdNameType.inbox; moveFolderRequest.ToFolderId = new TargetFolderIdType(); moveFolderRequest.ToFolderId.Item = toFolderId; // Move the specified folder. MoveFolderResponseType moveFolderResponse = this.FOLDAdapter.MoveFolder(moveFolderRequest); // Check the response. Common.CheckOperationSuccess(moveFolderResponse, 1, this.Site); FolderIdType movedFolderId = ((FolderInfoResponseMessageType)moveFolderResponse.ResponseMessages.Items[0]).Folders[0].FolderId; // Save the new created folder's folder id. this.NewCreatedFolderIds.Add(movedFolderId); #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R4314"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R4314 this.Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, moveFolderResponse.ResponseMessages.Items[0].ResponseCode, 4314, @"[In MoveFolder Operation]A successful MoveFolder operation request returns a MoveFolderResponse element with the ResponseCode element of the MoveFolderResponse element set to ""NoError""."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R43144"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R43144 this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, moveFolderResponse.ResponseMessages.Items[0].ResponseClass, 43144, @"[In MoveFolder Operation]A successful MoveFolder operation request returns a MoveFolderResponse element with the ResponseClass attribute of the MoveFolderResponseMessage element set to ""Success""."); #region Get the inbox folder's folder id DistinguishedFolderIdType folder = new DistinguishedFolderIdType(); folder.Id = DistinguishedFolderIdNameType.inbox; // GetFolder request. GetFolderType getInboxFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, folder); // Get the Inbox folder. GetFolderResponseType getInboxFolderResponse = this.FOLDAdapter.GetFolder(getInboxFolderRequest); // Check the response. Common.CheckOperationSuccess(getInboxFolderResponse, 1, this.Site); // Variable to save folder. FolderInfoResponseMessageType inboxFolder = (FolderInfoResponseMessageType)getInboxFolderResponse.ResponseMessages.Items[0]; BaseFolderType inboxFolderInfo = (BaseFolderType)inboxFolder.Folders[0]; // Save the inbox's folder id. FolderIdType inboxFolderId = inboxFolderInfo.FolderId; #endregion #region Get the new created folder after moved to inbox folder // GetFolder request. GetFolderType getSubFolderRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, movedFolderId); // Get the specified folder. GetFolderResponseType getSubFolderResponse = this.FOLDAdapter.GetFolder(getSubFolderRequest); // Check the response. Common.CheckOperationSuccess(getSubFolderResponse, 1, this.Site); FolderInfoResponseMessageType allFolders = (FolderInfoResponseMessageType)getSubFolderResponse.ResponseMessages.Items[0]; BaseFolderType folderInfo = (BaseFolderType)allFolders.Folders[0]; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R595"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R595 // Since one message in the folder before move, if TotalCount for the folder is 1 after move, this requirement can be captured. this.Site.CaptureRequirementIfAreEqual <int>( 1, folderInfo.TotalCount, 595, @"[In MoveFolder Operation]The contents of the folder move with the folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R461"); // The moved folder can be gotten successfully, so the specified folder was moved. this.Site.CaptureRequirement( 461, @"[In m:MoveFolderType Complex Type]The MoveFolderType complex type specifies a request message to move folders in a mailbox."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R429"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R429 this.Site.CaptureRequirementIfAreEqual <string>( inboxFolderId.Id, folderInfo.ParentFolderId.Id, 429, @"[In MoveFolder Operation]The MoveFolder operation moves folders from a specified parent folder and puts them in another parent folder."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R594"); // Verify MS-OXWSFOLD_R594. // Verify if the values of FolderClass and DisplayName property are changed after the folder being moved. bool isVerifyR594 = folderInfo.FolderClass == "IPF.MyCustomFolderClass" && folderInfo.DisplayName == createFolderRequest.Folders[0].DisplayName; Site.Log.Add( LogEntryKind.Debug, "FolderClass expected to be \"IPF.MyCustomFolderClass\" and actual is {0};\n" + "DisplayName expected to be {1} and actual is {2};\n ", folderInfo.FolderClass, createFolderRequest.Folders[0].DisplayName, folderInfo.DisplayName); Site.CaptureRequirementIfIsTrue( isVerifyR594, 594, @"[In MoveFolder Operation]The properties FolderClass and DisplayName of the folder move with the folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R7501"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R7501 // Only one child folder was created in the folder. this.Site.CaptureRequirementIfAreEqual <int>( 1, folderInfo.ChildFolderCount, 7501, @"[In t:BaseFolderType Complex Type]ChildFolderCount specifies the total number of child folders in a folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R5912"); // Child folder count is returned from server so this requirement can be captured. this.Site.CaptureRequirement( 5912, @"[In t:BaseFolderType Complex Type]This property[ChildFolderCount] is returned in a response."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R75"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R75 this.Site.CaptureRequirementIfIsNotNull( folderInfo.ChildFolderCount, 75, @"[In t:BaseFolderType Complex Type]The type of element ChildFolderCount is xs:int."); #region Get subfolder in the moved folder // GetFolder request. GetFolderType getSubFolderAfterMovedRequest = this.GetGetFolderRequest(DefaultShapeNamesType.AllProperties, subFolderId); // Get the specified folder. GetFolderResponseType getFolderAfterMovedResponse = this.FOLDAdapter.GetFolder(getSubFolderAfterMovedRequest); // Check the response. Common.CheckOperationSuccess(getFolderAfterMovedResponse, 1, this.Site); allFolders = (FolderInfoResponseMessageType)getFolderAfterMovedResponse.ResponseMessages.Items[0]; folderInfo = (BaseFolderType)allFolders.Folders[0]; #endregion // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R596"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R596 this.Site.CaptureRequirementIfAreEqual <string>( movedFolderId.ToString(), folderInfo.ParentFolderId.ToString(), 596, @"[In MoveFolder Operation]The subfolders of the folder move with the folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R68"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R68 // Parent folder id is returned from server, and schema is verified in adapter so this requirement can be covered. this.Site.CaptureRequirementIfIsNotNull( folderInfo.ParentFolderId, 68, @"[In t:BaseFolderType Complex Type]The type of element ParentFolderId is t:FolderIdType."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSFOLD_R6801"); // Verify MS-OXWSFOLD requirement: MS-OXWSFOLD_R6801 this.Site.CaptureRequirementIfAreEqual <string>( NewCreatedFolderIds[0].ToString(), folderInfo.ParentFolderId.ToString(), 6801, @"[In t:BaseFolderType Complex Type]ParentFolderId specifies the folder identifier and change key for the parent folder."); }
public void WriteDataBatch(List <ItemInformation> dataBatch) { List <ItemInformation> list = new List <ItemInformation>(Math.Min(dataBatch.Count, Constants.ReadWriteBatchSize)); string parentFolderId = null; string text = string.Empty; ProgressRecord progressRecord = new ProgressRecord(this.dataContext); try { foreach (ItemInformation itemInformation in dataBatch) { if (this.progressController.IsStopRequested) { break; } BaseFolderType parentFolder = this.targetFolderProvider.GetParentFolder(this.targetMailbox, itemInformation.Id.ParentFolder, this.includeDuplicates); if (parentFolder == null) { progressRecord.ReportItemError(itemInformation.Id, null, ExportErrorType.ParentFolderNotFound, string.Format("EDiscoveryError:E007:: Parent folder for this item is not found.", new object[0])); } else { parentFolderId = parentFolder.FolderId.Id; if (text == string.Empty) { text = parentFolder.FolderId.Id; } if (itemInformation.Error == null) { if (itemInformation.Id.IsDuplicate) { progressRecord.ReportItemExported(itemInformation.Id, null, null); } else { if (text != parentFolder.FolderId.Id || list.Count == Constants.ReadWriteBatchSize) { this.CopyItemsToTargetMailbox(text, list, progressRecord); text = parentFolder.FolderId.Id; list.Clear(); } list.Add(itemInformation); } } else { progressRecord.ReportItemError(itemInformation.Id, null, itemInformation.Error.ErrorType, itemInformation.Error.Message); } } } if (list.Count > 0) { this.CopyItemsToTargetMailbox(parentFolderId, list, progressRecord); list.Clear(); } } finally { this.timer.Stop(); if (progressRecord != null) { progressRecord.ReportDuration(this.timer.Elapsed); this.progressController.ReportProgress(progressRecord); } this.timer.Restart(); } }