/// <summary> /// Copy contact item on the server. /// </summary> /// <param name="copyItemRequest">The request of CopyItem operation.</param> /// <returns>A response to CopyItem operation request.</returns> public CopyItemResponseType CopyItem(CopyItemType copyItemRequest) { CopyItemResponseType copyItemRespose = this.exchangeServiceBinding.CopyItem(copyItemRequest); #region Verify CopyItem operation requirements this.VerifySoapVersion(); this.VerifyTransportType(); this.VerifyCopyContactItem(this.exchangeServiceBinding.IsSchemaValidated); #endregion return(copyItemRespose); }
/// <summary> /// Copy tasks on the server according to items' id. /// </summary> /// <param name="itemIds">The item id of tasks which will be copied.</param> /// <returns>The extracted items id array.</returns> protected ItemIdType[] CopyTasks(params ItemIdType[] itemIds) { // Define the CopyItem request. CopyItemType copyItemRequest = TestSuiteHelper.GenerateCopyItemRequest(itemIds); // Call the CopyItem method to copy the task items created in previous steps. CopyItemResponseType copyItemResponse = this.TASKAdapter.CopyItem(copyItemRequest); this.VerifyResponseMessage(copyItemResponse); // Save the ItemId of task item got from the CopyItem response. return(Common.GetItemIdsFromInfoResponse(copyItemResponse)); }
/// <summary> /// Copy items and puts the items in a different folder. /// </summary> /// <param name="copyItemRequest">Specify a request to copy items on the server.</param> /// <returns>A response to CopyItem operation request.</returns> public CopyItemResponseType CopyItem(CopyItemType copyItemRequest) { CopyItemResponseType response = this.exchangeServiceBinding.CopyItem(copyItemRequest); Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null."); // SOAP version is set to 1.1, if a response can be received from server, then it means SOAP 1.1 is supported. this.VerifySoapVersion(); // Verify transport type related requirement. this.VerifyTransportType(); this.VerifyServerVersionInfo(this.exchangeServiceBinding.ServerVersionInfoValue, this.exchangeServiceBinding.IsSchemaValidated); this.VerifyCopyItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated); return response; }
/// <summary> /// Moves the given message to the given folder. /// </summary> public void CopyMessageToFolder(ItemIdType messageId, string folderId) { var binding = ChannelHelper.BuildChannel(hostname, username, password); var request = new CopyItemType { ItemIds = new BaseItemIdType[] { messageId }, ToFolderId = new TargetFolderIdType { Item = new FolderIdType { Id = folderId } } }; CopyItemResponseType moveItemResponse = binding.CopyItem(request); if (moveItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error) throw new Exception(moveItemResponse.ResponseMessages.Items[0].MessageText); }
/// <summary> /// Copy items and puts the items in a different folder. /// </summary> /// <param name="copyItemRequest">Specify a request to copy items on the server.</param> /// <returns>A response to CopyItem operation request.</returns> public CopyItemResponseType CopyItem(CopyItemType copyItemRequest) { CopyItemResponseType response = this.exchangeServiceBinding.CopyItem(copyItemRequest); Site.Assert.IsNotNull(response, "If the operation is successful, the response should not be null."); // SOAP version is set to 1.1, if a response can be received from server, then it means SOAP 1.1 is supported. this.VerifySoapVersion(); // Verify transport type related requirement. this.VerifyTransportType(); this.VerifyServerVersionInfo(this.exchangeServiceBinding.ServerVersionInfoValue, this.exchangeServiceBinding.IsSchemaValidated); this.VerifyCopyItemResponse(response, this.exchangeServiceBinding.IsSchemaValidated); return(response); }
/// <summary> /// Copy the calendar related item elements. /// </summary> /// <param name="request">A request to the CopyItem operation.</param> /// <returns>The response message returned by CopyItem operation.</returns> public CopyItemResponseType CopyItem(CopyItemType request) { if (request == null) { throw new ArgumentException("The request of operation 'CopyItem' should not be null."); } CopyItemResponseType copyItemResponse = this.exchangeServiceBinding.CopyItem(request); Site.Assert.IsNotNull(copyItemResponse, "If the operation is successful, the response should not be null."); this.VerifySoapVersion(); this.VerifyTransportType(); this.VerifyCopyItemOperation(copyItemResponse, this.exchangeServiceBinding.IsSchemaValidated); return(copyItemResponse); }
/// <summary> /// Copies Task items and puts the items in a different folder. /// </summary> /// <param name="copyItemRequest">Specifies a request to copy Task items on the server.</param> /// <returns>A response to this operation request.</returns> public CopyItemResponseType CopyItem(CopyItemType copyItemRequest) { CopyItemResponseType copyItemResponse = this.exchangeServiceBinding.CopyItem(copyItemRequest); Site.Assert.IsNotNull(copyItemResponse, "If the operation is successful, the response should not be null."); // Verify the copy item operation. this.VerifyCopyItemOperation(copyItemResponse, this.exchangeServiceBinding.IsSchemaValidated); // Verify Soap version requirements. this.VerifySoapVersion(); // Verify transport requirements. this.VerifyTransportType(); return(copyItemResponse); }
public void MSOXWSCONT_S03_TC01_CopyContactItem() { #region Step 1:Create the contact item. // Create a contact item. ContactItemType item = this.BuildContactItemWithRequiredProperties(); CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item); // Check the response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Step 2:Copy the contact item. CopyItemType copyItemRequest = new CopyItemType(); CopyItemResponseType copyItemResponse = new CopyItemResponseType(); // Configure ItemIds. copyItemRequest.ItemIds = new BaseItemIdType[1]; copyItemRequest.ItemIds[0] = this.ExistContactItems[0]; // Configure the copy Distinguished Folder. DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType(); distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts; copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem; copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest); // Check the response. Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); #endregion #region Step 3:Get the contact item. // The contact item to get. ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count]; this.ExistContactItems.CopyTo(itemArray, 0); GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray); // Check the response. Common.CheckOperationSuccess(getItemResponse, 2, this.Site); #endregion }
/// <summary> /// Moves the given message to the given folder. /// </summary> public void CopyMessageToFolder(ItemIdType messageId, string folderId) { var binding = ChannelHelper.BuildChannel(hostname, username, password); var request = new CopyItemType { ItemIds = new BaseItemIdType[] { messageId }, ToFolderId = new TargetFolderIdType { Item = new FolderIdType { Id = folderId } } }; CopyItemResponseType moveItemResponse = binding.CopyItem(request); if (moveItemResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Error) { throw new Exception(moveItemResponse.ResponseMessages.Items[0].MessageText); } }
public void MSOXWSCORE_S01_TC02_CopyItemSuccessfully() { #region Step 1: Create the item. ItemType item = new ItemType(); ItemIdType[] createdItemIds = this.CreateItemWithMinimumElements(item); #endregion #region Step 2: Copy the item. CopyItemType copyItemRequest = new CopyItemType(); CopyItemResponseType copyItemResponse = new CopyItemResponseType(); // Configure ItemIds. copyItemRequest.ItemIds = createdItemIds; // Configure copying item to draft folder. DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType(); distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts; copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem; copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest); // Check the operation response. Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIds = Common.GetItemIdsFromInfoResponse(copyItemResponse); // One copied item should be returned. Site.Assert.AreEqual<int>( 1, copiedItemIds.GetLength(0), "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIds.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R253"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R253 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( copyItemResponse, 253, @"[In m:CopyItemResponseType Complex Type] The CopyItemResponseType complex type extends the BaseResponseMessageType complex type ([MS-OXWSCDATA] section 2.2.4.16)."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1601"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1601 // The schema is validated, so this requirement can be captured. this.Site.CaptureRequirement( 1601, @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ItemIds""] Specifies an array of elements of type BaseItemIdType that specifies a set of items to be copied."); ItemInfoResponseMessageType copyItemResponseMessage = copyItemResponse.ResponseMessages.Items[0] as ItemInfoResponseMessageType; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1602"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1602 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( copyItemResponseMessage, "MS-OXWSCDATA", 1602, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""CopyItemResponseMessage"" is ""m:ItemInfoResponseMessageType"" type."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCDATA_R1057"); // Verify MS-OXWSCORE requirement: MS-OXWSCDATA_R1057 // The schema is validated and the response is not null, so this requirement can be captured. this.Site.CaptureRequirementIfIsNotNull( copyItemResponseMessage, "MS-OXWSCDATA", 1057, @"[In m:ArrayOfResponseMessagesType Complex Type] The element ""CopyItemResponseMessage"" with type ""m:ItemInfoResponseMessageType"" specifies the response message for the CopyItem operation ([MS-OXWSCORE] section 3.1.4.1)."); #endregion #region Step 3: Get the first created item success. // Call the GetItem operation. GetItemResponseType getItemResponse = this.CallGetItemOperation(createdItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); ItemIdType[] getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItemIds.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); #endregion #region Step 4: Get the second copied item success. // The Item properties returned. getItemResponse = this.CallGetItemOperation(copiedItemIds); // Check the operation response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); getItemIds = Common.GetItemIdsFromInfoResponse(getItemResponse); // One item should be returned. Site.Assert.AreEqual<int>( 1, getItemIds.GetLength(0), "One item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, getItemIds.GetLength(0)); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1600"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1600 // If the copied item was got successfully, R1600 can be captured. this.Site.CaptureRequirement( 1600, @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ToFolderId""] Specifies an instance of the TargetFolderIdType complex type that specifies the folder to which the items specified by the ItemIds property are to be copied."); #endregion }
public void MSOXWSMSG_S03_TC01_CopyMessage() { #region Create message CreateItemType createItemRequest = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts); CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); // Save the ItemId of message responseMessageItem got from the createItem response. ItemIdType itemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; #endregion #region Copy message CopyItemType copyItemRequest = new CopyItemType { ItemIds = new ItemIdType[] { itemIdType }, // Save the copy message to inbox folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.inbox } } }; CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest); Site.Assert.IsTrue(this.VerifyResponse(copyItemResponse), @"Server should return success for copying the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(copyItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type from server response should not be null."); // Save the ItemId of message responseMessageItem got from the copyItem response. ItemIdType copyItemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); copyItemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; #region Verify the requirements about CopyItem // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R168"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R168 Site.CaptureRequirementIfIsNotNull( copyItemResponse, 168, @"[In CopyItem] The protocol client sends a CopyItemSoapIn request WSDL message, and the protocol server responds with a CopyItemSoapOut response WSDL message."); Site.Assert.IsNotNull(this.infoItems[0].ResponseClass, @"The ResponseClass property of the first item of infoItems instance should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R169"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R169 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Success, copyItemResponse.ResponseMessages.Items[0].ResponseClass, 169, @"[In CopyItem] If the CreateItem WSDL operation request is successful, the server returns a CreateItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.2.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the CreateItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". "); Site.Assert.IsNotNull(this.infoItems[0].ResponseCode, @"The ResponseCode property of the first item of infoItems instance should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R170"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R170 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.NoError, copyItemResponse.ResponseMessages.Items[0].ResponseCode, 170, @"[In CopyItem] [A successful CopyItem operation request returns a CopyItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the CreateItemResponseMessage element is set to ""NoError"". "); #endregion #endregion #region Delete the copied Email messages DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { itemIdType, copyItemIdType } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion }
public void MSOXWSMSG_S03_TC02_CopyMessageUnsuccessful() { #region Create message CreateItemType createItemRequest = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts); CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); // Save the ItemId of message responseMessageItem got from the createItem response. ItemIdType itemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; #endregion #region Delete the message created DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion #region Copy message deleted CopyItemType copyItemRequest = new CopyItemType { ItemIds = new ItemIdType[] { itemIdType }, // Save the copy message to inbox folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.inbox } } }; CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R170001"); this.Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Error, copyItemResponse.ResponseMessages.Items[0].ResponseClass, 170001, @"[In CopyItem] If the CreateItem WSDL operation is not successful, it returns a CreateItemResponse element with the ResponseClass attribute of the CreateItemResponseMessage element set to ""Error"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R170002"); this.Site.CaptureRequirementIfIsTrue( System.Enum.IsDefined(typeof(ResponseCodeType), copyItemResponse.ResponseMessages.Items[0].ResponseCode), 170002, @"[In CopyItem] [A unsuccessful CopyItem operation request returns a CopyItemResponse element] The ResponseCode element of the CreateItemResponseMessage element is set to one of the common errors defined in [MS-OXWSCDATA] section 2.2.5.24."); #endregion }
public void MSOXWSMSG_S03_TC02_CopyMessageUnsuccessful() { #region Create message CreateItemType createItemRequest = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts); CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); // Save the ItemId of message responseMessageItem got from the createItem response. ItemIdType itemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; #endregion #region Delete the message created DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { this.firstItemOfFirstInfoItem.ItemId } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion #region Copy message deleted CopyItemType copyItemRequest = new CopyItemType { ItemIds = new ItemIdType[] { itemIdType }, // Save the copy message to inbox folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.inbox } } }; CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R170001"); this.Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Error, copyItemResponse.ResponseMessages.Items[0].ResponseClass, 170001, @"[In CopyItem] If the CreateItem WSDL operation is not successful, it returns a CreateItemResponse element with the ResponseClass attribute of the CreateItemResponseMessage element set to ""Error"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R170002"); this.Site.CaptureRequirementIfIsTrue( System.Enum.IsDefined(typeof(ResponseCodeType), copyItemResponse.ResponseMessages.Items[0].ResponseCode), 170002, @"[In CopyItem] [A unsuccessful CopyItem operation request returns a CopyItemResponse element] The ResponseCode element of the CreateItemResponseMessage element is set to one of the common errors defined in [MS-OXWSCDATA] section 2.2.5.24."); #endregion }
/// <remarks/> public void CopyItemAsync(CopyItemType CopyItem1, object userState) { if ((CopyItemOperationCompleted == null)) { CopyItemOperationCompleted = new SendOrPostCallback(OnCopyItemOperationCompleted); } InvokeAsync("CopyItem", new object[] { CopyItem1 }, CopyItemOperationCompleted, userState); }
static int Main(string[] commandArgs) { int returnValue = 0; try { if (commandArgs.Length < 1) //error, no arg. supplied { string errMsg = "No argument supplied.\n"; errMsg += "\tUsage: " + Process.GetCurrentProcess().ProcessName + " <Build Import Manifest>\n"; errMsg += "\tFor example, " + Process.GetCurrentProcess().ProcessName + " BuildImports.xml"; throw new Exception(errMsg); } if (!File.Exists(commandArgs[0])) { throw new Exception("File not found: " + commandArgs[0]); } //Get build attributes. Note: This module always expects q:\ to be mapped to the build path by //LibraryBuilder prior to invocation. LibraryManifest currManifest = new LibraryManifest(LBEnvironment.BuildMapDrive); string buildDefinitionFile = ProductBuildDataSet.GetBuildConfigurationFilename(LBEnvironment.BuildMapDrive); ProductBuildDataSet pbDataSet = ProductBuildDataSet.ReadBuildConfigurationFile(buildDefinitionFile); string buildProfile = pbDataSet.GetBuildProperty("BuildProfileName"); //Parse the xml file. XmlDocument xmlManifestDoc = new XmlDocument(); xmlManifestDoc.Load(commandArgs[0]); //file may or may not contain version info XmlNode versionNode = xmlManifestDoc.DocumentElement.Attributes.GetNamedItem("version"); int fileVersion = (versionNode == null)? 1 : int.Parse(versionNode.InnerText); //version 3 or higher is implemented in LB and uses zip file implementation if (fileVersion >= 3) { FileSystemInterface.ValidateComponentImportStep(LBEnvironment.BuildMapDrive, currManifest.GetBranchOrTrunkName(), commandArgs[0], false, true, false); } else { foreach (XmlNode importNode in xmlManifestDoc.DocumentElement.ChildNodes) { if (importNode.NodeType != XmlNodeType.Comment) { string prodName = importNode.Attributes["sourceProduct"].InnerText; string prodVer = importNode.Attributes["sourceVersion"].InnerText; string platCode = importNode.Attributes["sourcePlatform"].InnerText; string branchOrTrunkName = importNode.Attributes["sourceBranchOrTrunkName"].InnerText; string itemToCopy = importNode.SelectSingleNode("source").Attributes["path"].InnerText; string destPath = importNode.SelectSingleNode("destination").Attributes["path"].InnerText;; bool copySubdirectories = false; bool cleanAtDestination = false; if (fileVersion > 1) { copySubdirectories = bool.Parse(importNode.SelectSingleNode("source").Attributes["copySubDirectories"].InnerText.ToLower()); cleanAtDestination = bool.Parse(importNode.SelectSingleNode("source").Attributes["cleanDestination"].InnerText.ToLower()); } //Trim spaces and path characters itemToCopy = itemToCopy.Trim(new char[] { ' ', '\\', '/' }); destPath = destPath.Trim(new char[] { ' ', '\\', '/' }); string productPath = LBEnvironment.NetworkProductRootDir + "\\" + prodName + "\\V" + prodVer.Replace(".", "_") + "." + platCode; if (!Directory.Exists(productPath)) { throw new Exception("Product directory not found: " + productPath); } //Compute and identify - directory, file or wildcard - what to copy. Compute the destination as well. // Also indicate whether listed path exists. string sourceFullPath = productPath + "\\" + branchOrTrunkName + "\\" + itemToCopy;; string destFullpath = Path.Combine(LBEnvironment.BuildMapDrive, destPath); string alternateSourceFullPath = productPath + "\\" + "DEVELOP" + "\\" + itemToCopy;; bool usingAlternateCopyPath = false; CopyItemType copyItemType = CopyItemType.UNIDENTIFIED; if (itemToCopy.IndexOf("*") > 1) { copyItemType = CopyItemType.WILDCARD; if (!Directory.Exists(Path.GetDirectoryName(sourceFullPath))) { usingAlternateCopyPath = true; alternateSourceFullPath = productPath + "\\" + "DEVELOP" + "\\" + itemToCopy; } } else if (Directory.Exists(sourceFullPath)) { copyItemType = CopyItemType.DIRECTORY; } else if (Directory.Exists(alternateSourceFullPath)) { copyItemType = CopyItemType.DIRECTORY; usingAlternateCopyPath = true; } else if (File.Exists(sourceFullPath)) { copyItemType = CopyItemType.FILE; } else if (File.Exists(alternateSourceFullPath)) { copyItemType = CopyItemType.FILE; usingAlternateCopyPath = true; } else //Listed path not valid { throw new Exception("Unable to find import source: " + sourceFullPath); } //Create the destination directory Directory.CreateDirectory(destFullpath); //For QA profiles or non-DEVELOP builds, a build must fail if a listed path cannot be found. Accept no substitutes: //A listed path must not be from DEVELOP, PREPROD, PROD or CANDIDATE and it must exist if (buildProfile.ToUpper().StartsWith("QA") || (currManifest.GetBranchOrTrunkName().ToUpper() != "DEVELOP")) { if ((branchOrTrunkName.ToUpper() == "DEVELOP") || (branchOrTrunkName.ToUpper() == "CANDIDATE") || (branchOrTrunkName.ToUpper() == "PREPROD") || (branchOrTrunkName.ToUpper() == "PROD") || (branchOrTrunkName.ToUpper() == "STABLE")) { string errMsg = "Cannot build QA level library or profile without a branch library import source. "; errMsg += "Please check your entry in " + commandArgs[0] + " for "; errMsg += prodName + " " + prodVer + " " + platCode + " " + branchOrTrunkName; throw new Exception(errMsg); } if (usingAlternateCopyPath) { throw new Exception("Unable to find import source: " + sourceFullPath); } } string sourceItem = (usingAlternateCopyPath)? alternateSourceFullPath : sourceFullPath; //If copying a directory add a wildcard if (copyItemType == CopyItemType.DIRECTORY) { sourceItem = Path.Combine(sourceItem, "*.*"); } //if clean copy was requested, delete source files' paths at destination if (cleanAtDestination && Directory.Exists(destFullpath)) { ImportComponents.DeleteFiles(Path.Combine(destFullpath, Path.GetFileName(sourceItem)), copySubdirectories); } returnValue = ImportComponents.XCopyDirToQDrive(sourceItem, destFullpath, copySubdirectories); if (returnValue != 0) { throw new Exception("xcopy returned an error(" + returnValue.ToString() + ") while copying " + sourceItem + " to " + destFullpath); } } }//foreach } } catch (Exception currExcept) { Console.WriteLine("Error occurred during build import: " + currExcept.Message); if (returnValue == 0) { returnValue = 1; } } return(returnValue); }
/// <summary> /// Copy contact item on the server. /// </summary> /// <param name="copyItemRequest">The request of CopyItem operation.</param> /// <returns>A response to CopyItem operation request.</returns> public CopyItemResponseType CopyItem(CopyItemType copyItemRequest) { CopyItemResponseType copyItemRespose = this.exchangeServiceBinding.CopyItem(copyItemRequest); #region Verify CopyItem operation requirements this.VerifySoapVersion(); this.VerifyTransportType(); this.VerifyCopyContactItem(this.exchangeServiceBinding.IsSchemaValidated); #endregion return copyItemRespose; }
public void MSOXWSMTGS_S03_TC05_CopyItemErrorCalendarCannotUseIdForRecurringMasterId() { #region Define a meeting int timeInterval = this.TimeInterval; CalendarItemType calendarItem = new CalendarItemType(); calendarItem.UID = Guid.NewGuid().ToString(); calendarItem.Subject = this.Subject; calendarItem.Start = DateTime.UtcNow; calendarItem.StartSpecified = true; timeInterval++; calendarItem.End = DateTime.Now.AddHours(timeInterval); calendarItem.EndSpecified = true; calendarItem.Location = this.Location; calendarItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) }; ItemInfoResponseMessageType item1 = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToAllAndSaveCopy); Site.Assert.IsNotNull(item1, "Server should return success for creating a recurring meeting."); CalendarItemType calendarInOrganizer = this.SearchSingleItem(Role.Organizer, DistinguishedFolderIdNameType.calendar, "IPM.Appointment", calendarItem.UID) as CalendarItemType; Site.Assert.IsNotNull(calendarInOrganizer, "The meeting should be found in organizer's Calendar folder after organizer calls CreateItem with CalendarItemCreateOrDeleteOperationType set to SendToAllAndSaveCopy."); #endregion #region Define a recurring calendar item DateTime startTime = DateTime.Now; DailyRecurrencePatternType pattern = new DailyRecurrencePatternType(); pattern.Interval = this.PatternInterval; NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType(); range.NumberOfOccurrences = this.NumberOfOccurrences; range.StartDate = startTime; CalendarItemType meetingItem = new CalendarItemType(); meetingItem.UID = Guid.NewGuid().ToString(); meetingItem.Subject = this.Subject; meetingItem.Start = startTime; meetingItem.StartSpecified = true; meetingItem.End = startTime.AddHours(this.TimeInterval); meetingItem.EndSpecified = true; meetingItem.Location = this.Location; meetingItem.Recurrence = new RecurrenceType(); meetingItem.Recurrence.Item = pattern; meetingItem.Recurrence.Item1 = range; meetingItem.RequiredAttendees = new AttendeeType[] { GetAttendeeOrResource(this.AttendeeEmailAddress) }; meetingItem.OptionalAttendees = new AttendeeType[] { GetAttendeeOrResource(this.OrganizerEmailAddress) }; meetingItem.Resources = new AttendeeType[] { GetAttendeeOrResource(this.RoomEmailAddress) }; #endregion #region Organizer creates a recurring calendar item with CalendarItemCreateOrDeleteOperationType value set to SendOnlyToAll CreateItemType createItemRequest = new CreateItemType(); createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ItemType[] { meetingItem }; createItemRequest.MessageDispositionSpecified = true; createItemRequest.MessageDisposition = MessageDispositionType.SaveOnly; createItemRequest.SendMeetingInvitationsSpecified = true; createItemRequest.SendMeetingInvitations = CalendarItemCreateOrDeleteOperationType.SendToNone; ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, meetingItem, CalendarItemCreateOrDeleteOperationType.SendOnlyToAll); #endregion #region Organizer copys the RecurringMasterId of the recurring calendar item #region Copy the recurring calendar item to Drafts folder through Id of recurring master getItem DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.drafts; TargetFolderIdType targetFolderId = new TargetFolderIdType(); targetFolderId.Item = folderId; OccurrenceItemIdType occurrenceId = new OccurrenceItemIdType(); occurrenceId.RecurringMasterId = calendarInOrganizer.ItemId.Id; occurrenceId.InstanceIndex = 1; CopyItemType copyItemRequest = new CopyItemType(); copyItemRequest.ItemIds = new BaseItemIdType[] { occurrenceId }; copyItemRequest.ToFolderId = targetFolderId; CopyItemResponseType response = this.MTGSAdapter.CopyItem(copyItemRequest); #endregion // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1223"); //Verify MS-OXWSMTGS requirement: MS-OXWSMTGS_R1223 Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.ErrorCalendarCannotUseIdForRecurringMasterId, response.ResponseMessages.Items[0].ResponseCode, 1223, @"[In Messages] ErrorCalendarCannotUseIdForRecurringMasterId: Specifies that the RecurringMasterId ([MS-OXWSCORE] section 2.2.4.35) does not correspond to a valid recurring master item."); #endregion #region Clean up organizer's calendar, sentitems and deleteditems folders and attendee's calendar, inbox and deleteditems folders. this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType> { DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.sentitems, DistinguishedFolderIdNameType.deleteditems }); this.CleanupFoldersByRole(Role.Attendee, new List <DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.calendar, DistinguishedFolderIdNameType.inbox, DistinguishedFolderIdNameType.deleteditems }); #endregion }
public void MSOXWSCONT_S05_TC01_OperateMultipleContactItems() { #region Step 1:Create the contact item. CreateItemType createItemRequest = new CreateItemType(); #region Config the contact items createItemRequest.Items = new NonEmptyArrayOfAllItemsType(); createItemRequest.Items.Items = new ContactItemType[2]; // Create the first contact item. createItemRequest.Items.Items[0] = this.BuildContactItemWithRequiredProperties(); // Create the second contact item. createItemRequest.Items.Items[1] = this.BuildContactItemWithRequiredProperties(); // Configure the SavedItemFolderId of CreateItem request to specify that the created item is saved under which folder. createItemRequest.SavedItemFolderId = new TargetFolderIdType() { Item = new DistinguishedFolderIdType() { Id = DistinguishedFolderIdNameType.contacts, } }; #endregion CreateItemResponseType createItemResponse = this.CONTAdapter.CreateItem(createItemRequest); // Check the response. Common.CheckOperationSuccess(createItemResponse, 2, this.Site); #endregion #region Step 2:Update the contact items. UpdateItemType updateItemRequest = new UpdateItemType() { // Configure ItemIds. ItemChanges = new ItemChangeType[] { new ItemChangeType() { Item = this.ExistContactItems[0], Updates = new ItemChangeDescriptionType[] { new SetItemFieldType() { Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.contactsFileAs }, Item1 = new ContactItemType() { FileAs = FileAsMappingType.LastFirstCompany.ToString() } } } }, new ItemChangeType() { Item = this.ExistContactItems[1], Updates = new ItemChangeDescriptionType[] { new SetItemFieldType() { Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.contactsFileAs }, Item1 = new ContactItemType() { FileAs = FileAsMappingType.LastCommaFirst.ToString() } } } } }, ConflictResolution = ConflictResolutionType.AlwaysOverwrite }; // Clear existContactItems for MoveItem. this.InitializeCollection(); UpdateItemResponseType updateItemResponse = new UpdateItemResponseType(); // Invoke UpdateItem operation. updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest); // Check the response. Common.CheckOperationSuccess(updateItemResponse, 2, this.Site); #endregion #region Step 3:Move the contact items. MoveItemType moveItemRequest = new MoveItemType(); MoveItemResponseType moveItemResponse = new MoveItemResponseType(); // Configure ItemIds. moveItemRequest.ItemIds = new BaseItemIdType[2]; moveItemRequest.ItemIds[0] = this.ExistContactItems[0]; moveItemRequest.ItemIds[1] = this.ExistContactItems[1]; // Clear existContactItems for MoveItem. this.InitializeCollection(); // Configure move Distinguished Folder. DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType(); distinguishedFolderId.Id = DistinguishedFolderIdNameType.drafts; moveItemRequest.ToFolderId = new TargetFolderIdType(); moveItemRequest.ToFolderId.Item = distinguishedFolderId; moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest); // Check the response. Common.CheckOperationSuccess(moveItemResponse, 2, this.Site); #endregion #region Step 4:Get the contact items. // The contact item to get. ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count]; this.ExistContactItems.CopyTo(itemArray, 0); GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray); // Check the response. Common.CheckOperationSuccess(getItemResponse, 2, this.Site); #endregion #region Step 5:Copy the contact items. CopyItemType copyItemRequest = new CopyItemType(); CopyItemResponseType copyItemResponse = new CopyItemResponseType(); // Configure ItemIds. copyItemRequest.ItemIds = new BaseItemIdType[2]; copyItemRequest.ItemIds[0] = this.ExistContactItems[0]; copyItemRequest.ItemIds[1] = this.ExistContactItems[1]; // Configure the copy Distinguished Folder. DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType(); distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts; copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem; copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest); // Check the response. Common.CheckOperationSuccess(copyItemResponse, 2, this.Site); #endregion }
/// <summary> /// Copy items to a destination folder and return the new ids for these items (Listing 5-14) /// </summary> /// <param name="binding">Exchange binding to use for the call</param> /// <param name="destinationFolderId">Destination for the items</param> /// <param name="itemsToCopy">Items to copy</param> /// <returns>List of new item ids</returns> /// public List<ItemIdType> CopyItemEx( BaseFolderIdType destinationFolderId, List<BaseItemIdType> itemsToCopy) { // STEP 1: First, we need to retrieve some unique information about // each item. Let's use the PR_SEARCH_KEY. Note that extended properties are // discussed in Chapter 13, "Extended Properties" // GetItemType getSearchKeyRequest = new GetItemType(); PathToExtendedFieldType searchKeyPath = new PathToExtendedFieldType(); searchKeyPath.PropertyTag = "0x300B"; searchKeyPath.PropertyType = MapiPropertyTypeType.Binary; // Use ItemResponseShapeType overload from chapter 3. We want the Id and the // search key // ItemResponseShapeType idAndSearchKeyShape = new ItemResponseShapeType( DefaultShapeNamesType.IdOnly, searchKeyPath); getSearchKeyRequest.ItemShape = idAndSearchKeyShape; getSearchKeyRequest.ItemIds = itemsToCopy.ToArray(); // Get the items // GetItemResponseType getSearchKeyResponse = this.GetItem(getSearchKeyRequest); List<string> base64SearchKeys = new List<string>( getSearchKeyResponse.ResponseMessages.Items.Length); // For each item, add the search keys to our list // foreach (ItemInfoResponseMessageType searchKeyMessage in getSearchKeyResponse.ResponseMessages.Items) { ExtendedPropertyType searchKeyProperty = searchKeyMessage.Items.Items[0].ExtendedProperty[0]; base64SearchKeys.Add((string)searchKeyProperty.Item); } // Now we have a list of the search keys for the items that we want to // copy. // STEP 2: Perform the copy CopyItemType copyItemRequest = new CopyItemType(); copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = destinationFolderId; // just copy the array from our GetItem request rather than building a // new one. // copyItemRequest.ItemIds = getSearchKeyRequest.ItemIds; CopyItemResponseType copyResponse = this.CopyItem(copyItemRequest); // Now, we know that we do not get new ids from the above request, but // we (read: you) SHOULD check the response code for each of the copies // operations. // // STEP 3: For each successful copy, we want to find the items by // search key. // FindItemType findBySearchKey = new FindItemType(); findBySearchKey.ItemShape = idAndSearchKeyShape; findBySearchKey.ParentFolderIds = new BaseFolderIdType[] { destinationFolderId }; findBySearchKey.Traversal = ItemQueryTraversalType.Shallow; findBySearchKey.Restriction = new RestrictionType(); // Here we need to build up our query. Rather than issuing several // FindItem calls, let's build up a single OR restriction here with a // bunch of items. Note that EWS restricts filter depths, so we // might need to break this up depending on how many items we are // copying... // if (base64SearchKeys.Count > 1) { OrType or = new OrType(); List<IsEqualToType> orChildren = new List<IsEqualToType>(); foreach (string searchKey in base64SearchKeys) { // Note that CreateIsEqualToSearchKey is implemented on the partial class // extension of RestrictionType. // IsEqualToType isEqualTo = RestrictionType.CreateIsEqualToSearchKey( searchKeyPath, searchKey); orChildren.Add(isEqualTo); } or.Items = orChildren.ToArray(); findBySearchKey.Restriction.Item = or; } else { // we only have one item. No need for the OR clause // IsEqualToType isEqualTo = RestrictionType.CreateIsEqualToSearchKey( searchKeyPath, base64SearchKeys[0]); findBySearchKey.Restriction.Item = isEqualTo; } FindItemResponseType findResponse = this.FindItem(findBySearchKey); // Since we searched in a single target folder, we will have a single // response message // FindItemResponseMessageType findResponseMessage = findResponse.ResponseMessages.Items[0] as FindItemResponseMessageType; ItemType[] foundItems = (findResponseMessage.RootFolder.Item as ArrayOfRealItemsType).Items; List<ItemIdType> newIds = new List<ItemIdType>(); foreach (ItemType item in foundItems) { newIds.Add(item.ItemId); } return newIds; }
public void MSOXWSMSG_S03_TC01_CopyMessage() { #region Create message CreateItemType createItemRequest = GetCreateItemType(MessageDispositionType.SaveOnly, DistinguishedFolderIdNameType.drafts); CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyCreateItemResponse(createItemResponse, MessageDispositionType.SaveOnly), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); // Save the ItemId of message responseMessageItem got from the createItem response. ItemIdType itemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; #endregion #region Copy message CopyItemType copyItemRequest = new CopyItemType { ItemIds = new ItemIdType[] { itemIdType }, // Save the copy message to inbox folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.inbox } } }; CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest); Site.Assert.IsTrue(this.VerifyResponse(copyItemResponse), @"Server should return success for copying the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(copyItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type from server response should not be null."); // Save the ItemId of message responseMessageItem got from the copyItem response. ItemIdType copyItemIdType = new ItemIdType(); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); copyItemIdType.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; #region Verify the requirements about CopyItem // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R168"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R168 Site.CaptureRequirementIfIsNotNull( copyItemResponse, 168, @"[In CopyItem] The protocol client sends a CopyItemSoapIn request WSDL message, and the protocol server responds with a CopyItemSoapOut response WSDL message."); Site.Assert.IsNotNull(this.infoItems[0].ResponseClass, @"The ResponseClass property of the first item of infoItems instance should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R169"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R169 Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Success, copyItemResponse.ResponseMessages.Items[0].ResponseClass, 169, @"[In CopyItem] If the CreateItem WSDL operation request is successful, the server returns a CreateItemResponse element, as specified in [MS-OXWSCORE] section 3.1.4.2.2.2, with the ResponseClass attribute, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the CreateItemResponseMessage element, as specified in [MS-OXWSCDATA] section 2.2.4.12, set to ""Success"". "); Site.Assert.IsNotNull(this.infoItems[0].ResponseCode, @"The ResponseCode property of the first item of infoItems instance should not be null."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMSG_R170"); // Verify MS-OXWSMSG requirement: MS-OXWSMSG_R170 Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.NoError, copyItemResponse.ResponseMessages.Items[0].ResponseCode, 170, @"[In CopyItem] [A successful CopyItem operation request returns a CopyItemResponse element] The ResponseCode element, as specified in [MS-OXWSCDATA] section 2.2.4.67, of the CreateItemResponseMessage element is set to ""NoError"". "); #endregion #endregion #region Delete the copied Email messages DeleteItemType deleteItemRequest = new DeleteItemType { ItemIds = new ItemIdType[] { itemIdType, copyItemIdType } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion }
/// <remarks/> public void CopyItemAsync(CopyItemType CopyItem1) { this.CopyItemAsync(CopyItem1, null); }
public void MSOXWSMSG_S06_TC01_OperateMultipleMessages() { #region Create multiple message string subject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 0); string anotherSubject = Common.GenerateResourceName(this.Site, Common.GetConfigurationPropertyValue("Subject", Site), 1); CreateItemType createItemRequest = new CreateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, SavedItemFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.drafts } }, Items = new NonEmptyArrayOfAllItemsType { // Create an responseMessageItem with two MessageType instances. Items = new MessageType[] { new MessageType { Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } }, Subject = subject, }, new MessageType { Sender = new SingleRecipientType { Item = new EmailAddressType { EmailAddress = this.Sender } }, ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } }, Subject = anotherSubject, } } }, }; CreateItemResponseType createItemResponse = this.MSGAdapter.CreateItem(createItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(createItemResponse), @"Server should return success for creating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(createItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the first ItemId of message responseMessageItem got from the createItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); ItemIdType itemIdType1 = new ItemIdType(); itemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the second ItemId. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); ItemIdType itemIdType2 = new ItemIdType(); itemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Get the multiple messages which created GetItemType getItemRequest = new GetItemType { // Set the two ItemIds got from CreateItem response. ItemIds = new ItemIdType[] { itemIdType1, itemIdType2 }, ItemShape = new ItemResponseShapeType { BaseShape = DefaultShapeNamesType.AllProperties, } }; GetItemResponseType getItemResponse = this.MSGAdapter.GetItem(getItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(getItemResponse), @"Server should return success for creating the email messages."); #endregion #region Update the multiple messages which created UpdateItemType updateItemRequest = new UpdateItemType { MessageDisposition = MessageDispositionType.SaveOnly, // MessageDispositionSpecified value needs to be set. MessageDispositionSpecified = true, // Create two ItemChangeType instances. ItemChanges = new ItemChangeType[] { new ItemChangeType { Item = itemIdType1, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageToRecipients }, // Update ToRecipients property of the first message. Item1 = new MessageType { ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient2 } } } }, } }, new ItemChangeType { Item = itemIdType2, Updates = new ItemChangeDescriptionType[] { new SetItemFieldType { Item = new PathToUnindexedFieldType { FieldURI = UnindexedFieldURIType.messageToRecipients }, // Update ToRecipients property of the second message. Item1 = new MessageType { ToRecipients = new EmailAddressType[] { new EmailAddressType { EmailAddress = this.Recipient1 } } } }, } } } }; UpdateItemResponseType updateItemResponse = this.MSGAdapter.UpdateItem(updateItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(updateItemResponse), @"Server should return success for updating the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(updateItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the UpdateItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); itemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; itemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the UpdateItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); itemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; itemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Copy the updated multiple message to junkemail CopyItemType copyItemRequest = new CopyItemType { ItemIds = new ItemIdType[] { itemIdType1, itemIdType2, }, // Copy the message to junk email folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.junkemail } } }; CopyItemResponseType copyItemResponse = this.MSGAdapter.CopyItem(copyItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(copyItemResponse), @"Server should return success for copying the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(copyItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the CopyItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); ItemIdType copyItemIdType1 = new ItemIdType(); copyItemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the CopyItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); ItemIdType copyItemIdType2 = new ItemIdType(); copyItemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Move the copied multiple message from junkemail to deleteditems MoveItemType moveItemRequest = new MoveItemType { // Set to copied message responseMessageItem id. ItemIds = new ItemIdType[] { copyItemIdType1, copyItemIdType2 }, // Move the copied messages to deleted items folder. ToFolderId = new TargetFolderIdType { Item = new DistinguishedFolderIdType { Id = DistinguishedFolderIdNameType.deleteditems } } }; MoveItemResponseType moveItemResponse = this.MSGAdapter.MoveItem(moveItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(moveItemResponse), @"Server should return success for moving the email messages."); this.infoItems = TestSuiteHelper.GetInfoItemsInResponse(moveItemResponse); this.firstItemOfFirstInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 0, 0); Site.Assert.IsNotNull(this.infoItems, @"InfoItems in the returned response should not be null."); Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem, @"The first item of the array of ItemType type returned from server response should not be null."); // Save the ItemId of the first message responseMessageItem got from the MoveItem response. Site.Assert.IsNotNull(this.firstItemOfFirstInfoItem.ItemId, @"The ItemId property of the first item should not be null."); copyItemIdType1.Id = this.firstItemOfFirstInfoItem.ItemId.Id; copyItemIdType1.ChangeKey = this.firstItemOfFirstInfoItem.ItemId.ChangeKey; // Save the ItemId of the second message responseMessageItem got from the MoveItem response. this.firstItemOfSecondInfoItem = TestSuiteHelper.GetItemTypeItemFromInfoItemsByIndex(this.infoItems, 1, 0); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem, @"The second item of the array of ItemType type returned from server response should not be null."); Site.Assert.IsNotNull(this.firstItemOfSecondInfoItem.ItemId, @"The ItemId property of the second item should not be null."); copyItemIdType2.Id = this.firstItemOfSecondInfoItem.ItemId.Id; copyItemIdType2.ChangeKey = this.firstItemOfSecondInfoItem.ItemId.ChangeKey; #endregion #region Send multiple messages SendItemType sendItemRequest = new SendItemType { // Set to the two updated messages' ItemIds. ItemIds = new ItemIdType[] { itemIdType1, itemIdType2 }, // Do not save copy. SaveItemToFolder = false, }; SendItemResponseType sendItemResponse = this.MSGAdapter.SendItem(sendItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(sendItemResponse), @"Server should return success for sending the email messages."); #endregion #region Delete the copied messages DeleteItemType deleteItemRequest = new DeleteItemType { // Set to the two copied messages' ItemIds. ItemIds = new ItemIdType[] { copyItemIdType1, copyItemIdType2 } }; DeleteItemResponseType deleteItemResponse = this.MSGAdapter.DeleteItem(deleteItemRequest); Site.Assert.IsTrue(this.VerifyMultipleResponse(deleteItemResponse), @"Server should return success for deleting the email messages."); #endregion #region Clean up Recipient1's and Recipient2's inbox folders bool isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Recipient2", this.Site), Common.GetConfigurationPropertyValue("Recipient2Password", this.Site), this.Domain, subject, "inbox"); Site.Assert.IsTrue(isClear, "Recipient2's inbox folder should be cleaned up."); isClear = this.MSGSUTControlAdapter.CleanupFolders( Common.GetConfigurationPropertyValue("Recipient1", this.Site), Common.GetConfigurationPropertyValue("Recipient1Password", this.Site), this.Domain, anotherSubject, "inbox"); Site.Assert.IsTrue(isClear, "Recipient1's inbox folder should be cleaned up."); #endregion }
public void MSOXWSCORE_S01_TC22_ReturnNewItemIdsIsIgnored() { Site.Assume.IsTrue(Common.IsRequirementEnabled(1230, this.Site), "Exchange 2007 does not support the ReturnNewItemIds element."); #region Step 1: Create the item. ItemType item = new ItemType(); ItemIdType[] createdItemIdsForReturnNewItemIdsValueTrue = this.CreateItemWithMinimumElements(item); ItemIdType[] createdItemIdsForReturnNewItemIdsValueFalse = this.CreateItemWithMinimumElements(item); ItemIdType[] createdItemIdsForNoReturnNewItemIds = this.CreateItemWithMinimumElements(item); #endregion #region Step 2: Copy the item with ReturnNewItemIds element setting to true. CopyItemType copyItemRequest = new CopyItemType(); CopyItemResponseType copyItemResponse = new CopyItemResponseType(); copyItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueTrue; DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType(); distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts; copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem; copyItemRequest.ReturnNewItemIds = true; copyItemRequest.ReturnNewItemIdsSpecified = true; copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest); Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIdsWithReturnNewItemIdsValueTrue = Common.GetItemIdsFromInfoResponse(copyItemResponse); Site.Assert.AreEqual<int>( 1, copiedItemIdsWithReturnNewItemIdsValueTrue.GetLength(0), "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIdsWithReturnNewItemIdsValueTrue.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); bool isReturnNewIdsForReturnNewItemIdsTrue = !copiedItemIdsWithReturnNewItemIdsValueTrue[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !copiedItemIdsWithReturnNewItemIdsValueTrue[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].Id, StringComparison.InvariantCultureIgnoreCase); #endregion #region Step 3: Copy the item with ReturnNewItemIds element setting to false. copyItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueFalse; copyItemRequest.ReturnNewItemIds = false; copyItemRequest.ReturnNewItemIdsSpecified = true; copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest); Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIdsWithReturnNewItemIdsValueFalse = Common.GetItemIdsFromInfoResponse(copyItemResponse); Site.Assert.AreEqual<int>( 1, copiedItemIdsWithReturnNewItemIdsValueFalse.GetLength(0), "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIdsWithReturnNewItemIdsValueFalse.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); bool isReturnNewIdsForReturnNewItemIdsFalse = !copiedItemIdsWithReturnNewItemIdsValueFalse[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !copiedItemIdsWithReturnNewItemIdsValueFalse[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].Id, StringComparison.InvariantCultureIgnoreCase); #endregion #region Step 4: Copy the item without ReturnNewItemIds element. copyItemRequest.ItemIds = createdItemIdsForNoReturnNewItemIds; copyItemRequest.ReturnNewItemIdsSpecified = false; copyItemResponse = this.COREAdapter.CopyItem(copyItemRequest); Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); ItemIdType[] copiedItemIdsWithoutReturnNewItemIds = Common.GetItemIdsFromInfoResponse(copyItemResponse); Site.Assert.AreEqual<int>( 1, copiedItemIdsWithoutReturnNewItemIds.GetLength(0), "One copied item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, copiedItemIdsWithoutReturnNewItemIds.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); bool isReturnNewIdsForNoReturnNewItemIds = !copiedItemIdsWithoutReturnNewItemIds[0].ChangeKey.Equals(createdItemIdsForNoReturnNewItemIds[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !copiedItemIdsWithoutReturnNewItemIds[0].Id.Equals(createdItemIdsForNoReturnNewItemIds[0].Id, StringComparison.InvariantCultureIgnoreCase); Site.Assert.IsTrue( isReturnNewIdsForReturnNewItemIdsTrue == isReturnNewIdsForReturnNewItemIdsFalse && isReturnNewIdsForReturnNewItemIdsFalse == isReturnNewIdsForNoReturnNewItemIds, "New item id should be always returned or not for CopyItem regardless of wheter including ReturnNewItemIds element and the value for it."); #endregion #region Step 5: Move the item with ReturnNewItemIds element setting to true. createdItemIdsForReturnNewItemIdsValueTrue = this.CreateItemWithMinimumElements(item); createdItemIdsForReturnNewItemIdsValueFalse = this.CreateItemWithMinimumElements(item); createdItemIdsForNoReturnNewItemIds = this.CreateItemWithMinimumElements(item); MoveItemType moveItemRequest = new MoveItemType(); moveItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueTrue; DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType(); distinguishedFolderId.Id = DistinguishedFolderIdNameType.inbox; moveItemRequest.ToFolderId = new TargetFolderIdType(); moveItemRequest.ToFolderId.Item = distinguishedFolderId; moveItemRequest.ReturnNewItemIds = true; moveItemRequest.ReturnNewItemIdsSpecified = true; MoveItemResponseType moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest); Common.CheckOperationSuccess(moveItemResponse, 1, this.Site); ItemIdType[] movedItemIdsForReturnNewItemIdsValueTrue = Common.GetItemIdsFromInfoResponse(moveItemResponse); Site.Assert.AreEqual<int>( 1, movedItemIdsForReturnNewItemIdsValueTrue.GetLength(0), "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, movedItemIdsForReturnNewItemIdsValueTrue.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); this.ExistItemIds.Remove(createdItemIdsForReturnNewItemIdsValueTrue[0]); isReturnNewIdsForReturnNewItemIdsTrue = !movedItemIdsForReturnNewItemIdsValueTrue[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !movedItemIdsForReturnNewItemIdsValueTrue[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueTrue[0].Id, StringComparison.InvariantCultureIgnoreCase); #endregion #region Step 6: Move the item with ReturnNewItemIds element setting to false. moveItemRequest.ItemIds = createdItemIdsForReturnNewItemIdsValueFalse; moveItemRequest.ReturnNewItemIds = false; moveItemRequest.ReturnNewItemIdsSpecified = true; moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest); Common.CheckOperationSuccess(moveItemResponse, 1, this.Site); ItemIdType[] movedItemIdsForReturnNewItemIdsValueFalse = Common.GetItemIdsFromInfoResponse(moveItemResponse); Site.Assert.AreEqual<int>( 1, movedItemIdsForReturnNewItemIdsValueFalse.GetLength(0), "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, movedItemIdsForReturnNewItemIdsValueFalse.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); this.ExistItemIds.Remove(createdItemIdsForReturnNewItemIdsValueFalse[0]); isReturnNewIdsForReturnNewItemIdsFalse = !movedItemIdsForReturnNewItemIdsValueFalse[0].ChangeKey.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !movedItemIdsForReturnNewItemIdsValueFalse[0].Id.Equals(createdItemIdsForReturnNewItemIdsValueFalse[0].Id, StringComparison.InvariantCultureIgnoreCase); #endregion #region Step 7: Move the item without ReturnNewItemIds element. moveItemRequest.ItemIds = createdItemIdsForNoReturnNewItemIds; moveItemRequest.ReturnNewItemIdsSpecified = false; moveItemResponse = this.COREAdapter.MoveItem(moveItemRequest); Common.CheckOperationSuccess(moveItemResponse, 1, this.Site); ItemIdType[] movedItemIdsForNoReturnNewItemIds = Common.GetItemIdsFromInfoResponse(moveItemResponse); Site.Assert.AreEqual<int>( 1, movedItemIdsForNoReturnNewItemIds.GetLength(0), "One moved item should be returned! Expected Item Count: {0}, Actual Item Count: {1}", 1, movedItemIdsForReturnNewItemIdsValueFalse.GetLength(0)); Site.Assert.IsTrue(this.IsSchemaValidated, "The schema should be validated."); this.ExistItemIds.Remove(createdItemIdsForNoReturnNewItemIds[0]); isReturnNewIdsForNoReturnNewItemIds = !movedItemIdsForNoReturnNewItemIds[0].ChangeKey.Equals(createdItemIdsForNoReturnNewItemIds[0].ChangeKey, StringComparison.InvariantCultureIgnoreCase) || !movedItemIdsForNoReturnNewItemIds[0].Id.Equals(createdItemIdsForNoReturnNewItemIds[0].Id, StringComparison.InvariantCultureIgnoreCase); Site.Assert.IsTrue( isReturnNewIdsForReturnNewItemIdsTrue == isReturnNewIdsForReturnNewItemIdsFalse && isReturnNewIdsForReturnNewItemIdsFalse == isReturnNewIdsForNoReturnNewItemIds, "New item id should be always returned or not for MoveItem regardless of wheter including ReturnNewItemIds element and the value for it."); if (Common.IsRequirementEnabled(1230, this.Site)) { // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R1230"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R1230 // The ReturnNewItemId was set in the MoveItem and CopyItem request and the operations was executed successfully as above, so this requirement can be captured. this.Site.CaptureRequirement( 1230, @"[In Appendix C: Product Behavior] Implementation does introduce the ReturnNewItemIds element. (<45> Section 2.2.4.16: The ReturnNewItemIds element was introduced in Microsoft Exchange Server 2010 Service Pack 1 (SP1) (Exchange 2010 SP1 and above follow this behavior).)"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSCORE_R47"); // Verify MS-OXWSCORE requirement: MS-OXWSCORE_R47 // ReturnNewItemIds is ignored by server, this requirement can be covered. this.Site.CaptureRequirement( 47, @"[In m:BaseMoveCopyItemType Complex Type] [The element ""ReturnNewItemIds""] Specifies a Boolean return value that indicates whether the ItemId element is to be returned for new items."); } #endregion }
public void MSOXWSMTGS_S03_TC04_CopyItemErrorCalendarCannotMoveOrCopyOccurrence() { #region Define a recurring calendar item DateTime startTime = DateTime.Now; DailyRecurrencePatternType pattern = new DailyRecurrencePatternType(); pattern.Interval = this.PatternInterval; NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType(); range.NumberOfOccurrences = this.NumberOfOccurrences; range.StartDate = startTime; CalendarItemType calendarItem = new CalendarItemType(); calendarItem.UID = Guid.NewGuid().ToString(); calendarItem.Subject = this.Subject; calendarItem.Start = startTime; calendarItem.StartSpecified = true; calendarItem.End = startTime.AddHours(this.TimeInterval); calendarItem.EndSpecified = true; calendarItem.Recurrence = new RecurrenceType(); calendarItem.Recurrence.Item = pattern; calendarItem.Recurrence.Item1 = range; #endregion #region Create the recurring calendar item and extract the Id of an occurrence item ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone); OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType(); occurrenceItemId.ChangeKey = item.Items.Items[0].ItemId.ChangeKey; occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id; occurrenceItemId.InstanceIndex = this.InstanceIndex; #endregion #region Copy one occurrence of the recurring calendar item DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.drafts; TargetFolderIdType targetFolderId = new TargetFolderIdType(); targetFolderId.Item = folderId; CopyItemType copyItemRequest = new CopyItemType(); copyItemRequest.ItemIds = new BaseItemIdType[] { occurrenceItemId }; copyItemRequest.ToFolderId = targetFolderId; CopyItemResponseType response = this.MTGSAdapter.CopyItem(copyItemRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1190"); // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1190 Site.CaptureRequirementIfAreEqual <ResponseClassType>( ResponseClassType.Error, response.ResponseMessages.Items[0].ResponseClass, 1190, @"[In Messages] If the request is unsuccessful, the CopyItem operation returns an CopyItemResponse element with the ResponseClass attribute of the CopyItemResponseMessage element set to ""Error"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1193"); // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1193 Site.CaptureRequirementIfAreEqual <ResponseCodeType>( ResponseCodeType.ErrorCalendarCannotMoveOrCopyOccurrence, response.ResponseMessages.Items[0].ResponseCode, 1193, @"[In Messages] ErrorCalendarCannotMoveOrCopyOccurrence: Specifies that an attempt was made to move or copy an occurrence of a recurring calendar item."); #endregion #region Clean up organizer's calendar folders. this.CleanupFoldersByRole(Role.Organizer, new List <DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.calendar }); #endregion }
/// <summary> /// Copy the calendar related item elements. /// </summary> /// <param name="request">A request to the CopyItem operation.</param> /// <returns>The response message returned by CopyItem operation.</returns> public CopyItemResponseType CopyItem(CopyItemType request) { if (request == null) { throw new ArgumentException("The request of operation 'CopyItem' should not be null."); } CopyItemResponseType copyItemResponse = this.exchangeServiceBinding.CopyItem(request); Site.Assert.IsNotNull(copyItemResponse, "If the operation is successful, the response should not be null."); this.VerifySoapVersion(); this.VerifyTransportType(); this.VerifyCopyItemOperation(copyItemResponse, this.exchangeServiceBinding.IsSchemaValidated); return copyItemResponse; }
public void MSOXWSMTGS_S03_TC04_CopyItemErrorCalendarCannotMoveOrCopyOccurrence() { #region Define a recurring calendar item DateTime startTime = DateTime.Now; DailyRecurrencePatternType pattern = new DailyRecurrencePatternType(); pattern.Interval = this.PatternInterval; NumberedRecurrenceRangeType range = new NumberedRecurrenceRangeType(); range.NumberOfOccurrences = this.NumberOfOccurrences; range.StartDate = startTime; CalendarItemType calendarItem = new CalendarItemType(); calendarItem.UID = Guid.NewGuid().ToString(); calendarItem.Subject = this.Subject; calendarItem.Start = startTime; calendarItem.StartSpecified = true; calendarItem.End = startTime.AddHours(this.TimeInterval); calendarItem.EndSpecified = true; calendarItem.Recurrence = new RecurrenceType(); calendarItem.Recurrence.Item = pattern; calendarItem.Recurrence.Item1 = range; #endregion #region Create the recurring calendar item and extract the Id of an occurrence item ItemInfoResponseMessageType item = this.CreateSingleCalendarItem(Role.Organizer, calendarItem, CalendarItemCreateOrDeleteOperationType.SendToNone); OccurrenceItemIdType occurrenceItemId = new OccurrenceItemIdType(); occurrenceItemId.ChangeKey = item.Items.Items[0].ItemId.ChangeKey; occurrenceItemId.RecurringMasterId = item.Items.Items[0].ItemId.Id; occurrenceItemId.InstanceIndex = this.InstanceIndex; #endregion #region Copy one occurrence of the recurring calendar item DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.drafts; TargetFolderIdType targetFolderId = new TargetFolderIdType(); targetFolderId.Item = folderId; CopyItemType copyItemRequest = new CopyItemType(); copyItemRequest.ItemIds = new BaseItemIdType[] { occurrenceItemId }; copyItemRequest.ToFolderId = targetFolderId; CopyItemResponseType response = this.MTGSAdapter.CopyItem(copyItemRequest); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1190"); // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1190 Site.CaptureRequirementIfAreEqual<ResponseClassType>( ResponseClassType.Error, response.ResponseMessages.Items[0].ResponseClass, 1190, @"[In Messages] If the request is unsuccessful, the CopyItem operation returns an CopyItemResponse element with the ResponseClass attribute of the CopyItemResponseMessage element set to ""Error"". "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXWSMTGS_R1193"); // Verify MS-OXWSMSG requirement: MS-OXWSMTGS_R1193 Site.CaptureRequirementIfAreEqual<ResponseCodeType>( ResponseCodeType.ErrorCalendarCannotMoveOrCopyOccurrence, response.ResponseMessages.Items[0].ResponseCode, 1193, @"[In Messages] ErrorCalendarCannotMoveOrCopyOccurrence: Specifies that an attempt was made to move or copy an occurrence of a recurring calendar item."); #endregion #region Clean up organizer's calendar folders. this.CleanupFoldersByRole(Role.Organizer, new List<DistinguishedFolderIdNameType>() { DistinguishedFolderIdNameType.calendar }); #endregion }
/// <summary> /// Copies Task items and puts the items in a different folder. /// </summary> /// <param name="copyItemRequest">Specifies a request to copy Task items on the server.</param> /// <returns>A response to this operation request.</returns> public CopyItemResponseType CopyItem(CopyItemType copyItemRequest) { CopyItemResponseType copyItemResponse = this.exchangeServiceBinding.CopyItem(copyItemRequest); Site.Assert.IsNotNull(copyItemResponse, "If the operation is successful, the response should not be null."); // Verify the copy item operation. this.VerifyCopyItemOperation(copyItemResponse, this.exchangeServiceBinding.IsSchemaValidated); // Verify Soap version requirements. this.VerifySoapVersion(); // Verify transport requirements. this.VerifyTransportType(); return copyItemResponse; }
/// <remarks/> public System.IAsyncResult BeginCopyItem(CopyItemType CopyItem1, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("CopyItem", new object[] { CopyItem1}, callback, asyncState); }
/// <remarks/> public void CopyItemAsync(CopyItemType CopyItem1, object userState) { if ((this.CopyItemOperationCompleted == null)) { this.CopyItemOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCopyItemOperationCompleted); } this.InvokeAsync("CopyItem", new object[] { CopyItem1}, this.CopyItemOperationCompleted, userState); }
public void MSOXWSCONT_S06_TC01_OperateContactItemWithoutOptionalElements() { #region Step 1:Create the contact item. // Create a contact item without optional elements. ContactItemType item = this.BuildContactItemWithRequiredProperties(); CreateItemResponseType createItemResponse = this.CallCreateItemOperation(item); // Check the response. Common.CheckOperationSuccess(createItemResponse, 1, this.Site); #endregion #region Step 2:Update the contact item. UpdateItemType updateItemRequest = new UpdateItemType() { // Configure ItemIds. ItemChanges = new ItemChangeType[] { new ItemChangeType() { Item = this.ExistContactItems[0], Updates = new ItemChangeDescriptionType[] { new SetItemFieldType() { Item = new PathToUnindexedFieldType() { FieldURI = UnindexedFieldURIType.contactsFileAs }, Item1 = new ContactItemType() { FileAs = FileAsMappingType.LastFirstCompany.ToString() } } } } }, ConflictResolution = ConflictResolutionType.AlwaysOverwrite }; // Clear existContactItems for MoveItem. this.InitializeCollection(); UpdateItemResponseType updateItemResponse = new UpdateItemResponseType(); // Invoke UpdateItem operation. updateItemResponse = this.CONTAdapter.UpdateItem(updateItemRequest); // Check the response. Common.CheckOperationSuccess(updateItemResponse, 1, this.Site); #endregion #region Step 3:Move the contact item. MoveItemType moveItemRequest = new MoveItemType(); MoveItemResponseType moveItemResponse = new MoveItemResponseType(); // Configure ItemIds. moveItemRequest.ItemIds = new BaseItemIdType[1]; moveItemRequest.ItemIds[0] = this.ExistContactItems[0]; // Clear existContactItems for MoveItem. this.InitializeCollection(); // Configure move Distinguished Folder. DistinguishedFolderIdType distinguishedFolderId = new DistinguishedFolderIdType(); distinguishedFolderId.Id = DistinguishedFolderIdNameType.drafts; moveItemRequest.ToFolderId = new TargetFolderIdType(); moveItemRequest.ToFolderId.Item = distinguishedFolderId; moveItemResponse = this.CONTAdapter.MoveItem(moveItemRequest); // Check the response. Common.CheckOperationSuccess(moveItemResponse, 1, this.Site); #endregion #region Step 4:Get the contact item. // The contact item to get. ItemIdType[] itemArray = new ItemIdType[this.ExistContactItems.Count]; this.ExistContactItems.CopyTo(itemArray, 0); GetItemResponseType getItemResponse = this.CallGetItemOperation(itemArray); // Check the response. Common.CheckOperationSuccess(getItemResponse, 1, this.Site); #endregion #region Step 5:Copy the contact item. CopyItemType copyItemRequest = new CopyItemType(); CopyItemResponseType copyItemResponse = new CopyItemResponseType(); // Configure ItemIds. copyItemRequest.ItemIds = new BaseItemIdType[1]; copyItemRequest.ItemIds[0] = this.ExistContactItems[0]; // Configure the copy Distinguished Folder. DistinguishedFolderIdType distinguishedFolderIdForCopyItem = new DistinguishedFolderIdType(); distinguishedFolderIdForCopyItem.Id = DistinguishedFolderIdNameType.drafts; copyItemRequest.ToFolderId = new TargetFolderIdType(); copyItemRequest.ToFolderId.Item = distinguishedFolderIdForCopyItem; copyItemResponse = this.CONTAdapter.CopyItem(copyItemRequest); // Check the response. Common.CheckOperationSuccess(copyItemResponse, 1, this.Site); #endregion }