Inheritance: BaseRequestType
コード例 #1
0
 /// <remarks/>
 public void UploadItemsAsync(UploadItemsType UploadItems1, object userState)
 {
     if ((this.UploadItemsOperationCompleted == null))
     {
         this.UploadItemsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUploadItemsOperationCompleted);
     }
     this.InvokeAsync("UploadItems", new object[] {
             UploadItems1}, this.UploadItemsOperationCompleted, userState);
 }
コード例 #2
0
 /// <remarks/>
 public void UploadItemsAsync(UploadItemsType UploadItems1)
 {
     this.UploadItemsAsync(UploadItems1, null);
 }
コード例 #3
0
 /// <remarks/>
 public System.IAsyncResult BeginUploadItems(UploadItemsType UploadItems1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("UploadItems", new object[] {
             UploadItems1}, callback, asyncState);
 }
コード例 #4
0
        /// <summary>
        /// Uploads the items into a specified folder.
        /// </summary>
        /// <param name="uploadItemsRequest">Specify the request for UploadItems operation.</param>
        /// <returns>The response to this operation request.</returns>
        public UploadItemsResponseType UploadItems(UploadItemsType uploadItemsRequest)
        {
            if (uploadItemsRequest == null)
            {
                throw new ArgumentException("The uploadItems should not be null.");
            }

            // Send the request and get the response.
            UploadItemsResponseType response = this.exchangeServiceBinding.UploadItems(uploadItemsRequest);
            this.VerifyTransportType();
            this.VerifySoapVersion();
            this.VerifyUploadItemsResponseType(response, this.exchangeServiceBinding.IsSchemaValidated);

            return response;
        }
コード例 #5
0
        /// <summary>
        /// Get the UploadItemsResponseMessageType response of UploadItems operation when this operation executes unsuccessfully.
        /// </summary>
        /// <param name="parentFolderId">Specifies the target folder in which to place the upload item.</param>
        /// <param name="createAction">Specifies the action for uploading items to the folder.</param>
        /// <returns>The array of UploadItemsResponseMessageType response.</returns>
        protected UploadItemsResponseMessageType[] UploadInvalidItems(Collection<string> parentFolderId, CreateActionType createAction)
        {
            #region Get the exported items and parent folder ID.
            // Get the exported items which is prepared for uploading.
            ExportItemsResponseMessageType[] exportedItem = this.ExportItems(false);
            #endregion

            #region Call UploadItems operation to upload the items that exported in last step to the server.
            // Initialize the upload items using the data of previous export items, and set that item CreateAction to a value of CreateActionType.
            UploadItemsType uploadInvalidItems = new UploadItemsType();
            uploadInvalidItems.Items = new UploadItemType[4];

            // The ID attribute of ItemId is empty.
            uploadInvalidItems.Items[0] = TestSuiteHelper.GenerateUploadItem(
                string.Empty,
                null,
                exportedItem[0].Data,
                parentFolderId[0],
                createAction);

            // The ID attribute of ItemId is valid and the ChangeKey is invalid.
            uploadInvalidItems.Items[1] = TestSuiteHelper.GenerateUploadItem(
                exportedItem[1].ItemId.Id,
                InvalidChangeKey,
                exportedItem[1].Data,
                parentFolderId[1],
                createAction);

            // The ID attribute of ItemId is invalid and the ChangeKey is null.
            uploadInvalidItems.Items[2] = TestSuiteHelper.GenerateUploadItem(
                InvalidItemId,
                null,
                exportedItem[2].Data,
                parentFolderId[2],
                createAction);

            // The ID attribute of ItemId is invalid and the ChangeKey is null.
            uploadInvalidItems.Items[3] = TestSuiteHelper.GenerateUploadItem(
                InvalidItemId,
                null,
                exportedItem[3].Data,
                parentFolderId[3],
                createAction);

            // Call UploadItems operation.
            UploadItemsResponseType uploadItemsResponse = this.BTRFAdapter.UploadItems(uploadInvalidItems);

            // Check whether the ExportItems operation is executed successfully.
            foreach (UploadItemsResponseMessageType responseMessage in uploadItemsResponse.ResponseMessages.Items)
            {
                Site.Assert.AreEqual<ResponseClassType>(
                ResponseClassType.Error,
                responseMessage.ResponseClass,
                string.Format(
                    @"The UploadItems operation should be unsuccessful. Expected response code: {0}, actual response code: {1}",
                    ResponseClassType.Error,
                    responseMessage.ResponseClass));
            }
            #endregion

            #region Verify the UploadItemsResponseType related requirements
            // Verify the UploadItemsResponseType related requirements.
            this.VerifyUploadItemsErrorResponse(uploadItemsResponse);
            #endregion

            #region Call GetResponseMessages to get the UploadItemsResponseMessageType items.
            // Get the UploadItemsResponseMessageType items.
            UploadItemsResponseMessageType[] uploadItemsResponseMessages = TestSuiteHelper.GetResponseMessages<UploadItemsResponseMessageType>(uploadItemsResponse);

            return uploadItemsResponseMessages;
            #endregion
        }
コード例 #6
0
        /// <summary>
        /// Get the UploadItemsResponseMessageType response of UploadItems operation when this operation executes successfully.
        /// </summary>
        /// <param name="exportedItems">The items exported from server.</param>
        /// <param name="parentFolderId">Specifies the target folder in which to place the upload item.</param>
        /// <param name="createAction">Specifies the action for uploading items to the folder.</param>
        /// <param name="isAssociatedSpecified">A Boolean value specifies whether IsAssociated attribute is specified.</param>
        /// <param name="isAssociated">Specifies the value of the IsAssociated attribute.</param>
        /// <param name="configureSOAPHeader">A Boolean value specifies whether configuring the SOAP header before calling operations.</param>
        /// <returns>The array of UploadItemsResponseMessageType response.</returns>
        protected UploadItemsResponseMessageType[] UploadItems(
            ExportItemsResponseMessageType[] exportedItems,
            Collection<string> parentFolderId,
            CreateActionType createAction,
            bool isAssociatedSpecified,
            bool isAssociated,
            bool configureSOAPHeader)
        {
            #region Call UploadItems operation to upload the items that exported in last step to the server.
            // Initialize the upload items using the data of previous exported items, and set that item CreateAction to a value of CreateActionType.
            UploadItemsType uploadItems = new UploadItemsType();
            uploadItems.Items = new UploadItemType[this.ItemCount];
            for (int i = 0; i < uploadItems.Items.Length; i++)
            {
                uploadItems.Items[i] = TestSuiteHelper.GenerateUploadItem(
                    exportedItems[i].ItemId.Id,
                    exportedItems[i].ItemId.ChangeKey,
                    exportedItems[i].Data,
                    parentFolderId[i],
                    createAction);
                uploadItems.Items[i].IsAssociatedSpecified = isAssociatedSpecified;
                if (uploadItems.Items[i].IsAssociatedSpecified)
                {
                    uploadItems.Items[i].IsAssociated = isAssociated;
                }
            }

            // Call UploadItems operation.
            UploadItemsResponseType uploadItemsResponse = this.BTRFAdapter.UploadItems(uploadItems);

            // Check whether the operation is executed successfully.
            foreach (UploadItemsResponseMessageType uploadResponse in uploadItemsResponse.ResponseMessages.Items)
            {
                Site.Assert.AreEqual<ResponseClassType>(
                ResponseClassType.Success,
                uploadResponse.ResponseClass,
                string.Format(
                    @"The UploadItems operation should be successful. Expected response code: {0}, actual response code: {1}",
                    ResponseClassType.Error,
                    uploadResponse.ResponseClass));
            }

            // If the operation executes successfully, the items in UploadItems response should be equal to the value of ItemCount
            Site.Assert.AreEqual<int>(
                uploadItemsResponse.ResponseMessages.Items.Length,
                this.ItemCount,
                string.Format(
                "The uploadItems response should contain {0} items, actually, it contains {1}",
                this.ItemCount,
                uploadItemsResponse.ResponseMessages.Items.Length));
            #endregion

            #region Verify the UploadItemsResponseType related requirements
            // Verify the UploadItemsResponseType related requirements.
            this.VerifyUploadItemsSuccessResponse(uploadItemsResponse);
            #endregion

            #region Call GetResponseMessages to get the UploadItemsResponseMessageType items.
            // Get the UploadItemsResponseMessageType items.
            UploadItemsResponseMessageType[] uploadItemsResponseMessages = TestSuiteHelper.GetResponseMessages<UploadItemsResponseMessageType>(uploadItemsResponse);

            return uploadItemsResponseMessages;
            #endregion
        }