コード例 #1
0
        /// <summary>
        /// The CreateContentType operation is used to create a new content type on a list.
        /// </summary>
        /// <param name="listName">The name of the list for which the content type will be created</param>
        /// <param name="displayName">The XML-encoded name of the content type to be created</param>
        /// <param name="parentType">The identification of a content type from which the content type to be created will inherit</param>
        /// <param name="fields">The container for a list of existing fields to be included in the content type </param>
        /// <param name="contentTypeProperties">The container for properties to set on the content type </param>
        /// <param name="addToView">Specifies whether the fields will be added to the default list view, where "TRUE" MUST correspond to true, and all other values to false</param>
        /// <returns>Return the ID of newly created content type.</returns>
        public string CreateContentType(string listName, string displayName, string parentType, AddOrUpdateFieldsDefinition fields, CreateContentTypeContentTypeProperties contentTypeProperties, string addToView)
        {
            this.Site.Assert.IsNotNull(this.listsProxy, "The Proxy instance should not be NULL. If assert failed, the adapter need to be initialized");
           
            string result = null;
            try
            {
                result = this.listsProxy.CreateContentType(listName, displayName, parentType, fields, contentTypeProperties, addToView);

                // Verify the requirements of CreateContentType operation.
                this.VerifyCreateContentTypeOperation(result);
            }
            catch (XmlSchemaValidationException exp)
            {
                // Log the errors and warnings
                this.LogSchemaValidationErrors();

                this.Site.Assert.Fail(exp.Message);
            }
            catch (SoapException)
            {
                this.VerifySoapExceptionFault();
                throw;
            }

            return result;
        }
コード例 #2
0
        /// <summary>
        /// The UpdateContentType operation is used to update a content type on a list.
        /// </summary>
        /// <param name="listName">The name of the list of which a content type will be updated</param>
        /// <param name="contentTypeId">The identifier of the content type which will be updated</param>
        /// <param name="contentTypeProperties">The container for properties to set on the content type</param>
        /// <param name="newFields">The new fields that will be used as parameter in UpdateContentType</param>
        /// <param name="updateFields">The fields that will be updated</param>
        /// <param name="deleteFields">The fields that will be used as parameter in UpdateContentType</param>
        /// <param name="addToView">Specifies whether the fields will be added to the default list view, "TRUE" means add to the view and "False" means not.</param>
        /// <returns>Update content type Result</returns>
        public UpdateContentTypeResponseUpdateContentTypeResult UpdateContentType(string listName, string contentTypeId, UpdateContentTypeContentTypeProperties contentTypeProperties, AddOrUpdateFieldsDefinition newFields, AddOrUpdateFieldsDefinition updateFields, DeleteFieldsDefinition deleteFields, string addToView)
        {
            this.Site.Assert.IsNotNull(this.listsProxy, "The Proxy instance should not be NULL. If assert failed, the adapter need to be initialized");

            UpdateContentTypeResponseUpdateContentTypeResult result = null;
            try
            {
                result = this.listsProxy.UpdateContentType(listName, contentTypeId, contentTypeProperties, newFields, updateFields, deleteFields, addToView);

                // Verify the requirements of the transport.
                this.VerifyTransportRequirements();

                // Verify the requirements of UpdateContentType operation.
                this.VerifyUpdateContentTypeOperation(result);
            }
            catch (XmlSchemaValidationException exp)
            {
                // Log the errors and warnings
                this.LogSchemaValidationErrors();

                this.Site.Assert.Fail(exp.Message);
            }
            catch (SoapException)
            {
                this.VerifySoapExceptionFault();
                throw;
            }

            return result;
        }
コード例 #3
0
        /// <summary>
        /// This method is used to Create a content type using the specified information.
        /// </summary>
        /// <param name="list">The list title or list id which the content type is created on.</param>
        /// <param name="displayName">The content type display name.</param>
        /// <param name="title">The content type title.</param>
        /// <param name="description">The content type description</param>
        /// <param name="parentTypeId">Specify the content type's parent content type ID.</param>
        /// <param name="addField">Specify the exist fields that adds into the list content type.</param>
        /// <returns>Return the content type id if successful, otherwise will fail the test case and log the reason</returns>
        private static string CreateContentType(string list, string displayName, string title, string description, string parentTypeId, AddOrUpdateFieldsDefinition addField)
        {
            CreateContentTypeContentTypeProperties addProperties = new CreateContentTypeContentTypeProperties();
            addProperties.ContentType = new ContentTypePropertyDefinition();
            addProperties.ContentType.Description = description;
            addProperties.ContentType.Title = title;

            string contentTypeId = null;

            try
            {
                contentTypeId = listswsAdapter.CreateContentType(
                                                    list,
                                                    displayName,
                                                    parentTypeId,
                                                    addField,
                                                    addProperties,
                                                    "TRUE");
            }
            catch (SoapException exp)
            {              
                testSite.Assert.Fail(ErrorMessageTemplate, "creating content type in the list " + list, exp.Detail.InnerText);
                throw;
            }

            return contentTypeId;
        }
コード例 #4
0
        /// <summary>
        /// Construct added fields for the UpdateContentType operation using the specified field names.
        /// </summary>
        /// <param name="fieldNames">The added field names.</param>
        /// <returns>The AddOrUpdateFieldsDefinition type instance used in the UpdateContentType operation.</returns>
        public static AddOrUpdateFieldsDefinition CreateAddContentTypeFields(params string[] fieldNames)
        {
            AddOrUpdateFieldsDefinition addField = new AddOrUpdateFieldsDefinition();
            addField.Fields = new AddOrUpdateFieldsDefinitionMethod[fieldNames.Length];
            for (int i = 0; i < fieldNames.Length; i++)
            {
                addField.Fields[i] = new AddOrUpdateFieldsDefinitionMethod();
                addField.Fields[i].ID = Guid.NewGuid().ToString();
                addField.Fields[i].Field = new AddOrUpdateFieldDefinition();
                addField.Fields[i].Field.Name = fieldNames[i];
            }

            return addField;
        }
コード例 #5
0
        /// <summary>
        /// This operation is used to create a new content type on the context site
        /// </summary>
        /// <param name="displayName">displayName means the XML encoded name of content type to be created.</param>
        /// <param name="parentType">parentType is used to indicate the ID of a content type from which the content type to be created will inherit.</param>
        /// <param name="newFields">newFields is the container for a list of existing fields to be included in the content type.</param>
        /// <param name="contentTypeProperties">contentTypeProperties is the container for properties to set on the content type.</param>
        /// <returns>The ID of Created ContentType.</returns>
        public string CreateContentType(string displayName, string parentType, AddOrUpdateFieldsDefinition newFields, CreateContentTypeContentTypeProperties contentTypeProperties)
        {
            string contentTypeId = this.service.CreateContentType(displayName, parentType, newFields, contentTypeProperties);

            this.ValidateCreateContentType();
            this.CaptureTransportRelatedRequirements();

            return contentTypeId;
        }
コード例 #6
0
        /// <summary>
        /// This operation is used to update a content type on the context site.
        /// </summary>
        /// <param name="contentTypeId">contentTypeID is the ID of the content type to be updated.</param>
        /// <param name="contentTypeProperties">properties is the container for properties to set on the content type.</param>
        /// <param name="newFields">newFields is the container for a list of existing fields to be included in the content type.</param>
        /// <param name="updateFields">updateFields is the container for a list of fields to be updated on the content type.</param>
        /// <param name="deleteFields">deleteFields is the container for a list of fields to be updated on the content type.</param>
        /// <returns>The result of UpdateContentType.</returns>
        public UpdateContentTypeResponseUpdateContentTypeResult UpdateContentType(string contentTypeId, UpdateContentTypeContentTypeProperties contentTypeProperties, AddOrUpdateFieldsDefinition newFields, AddOrUpdateFieldsDefinition updateFields, DeleteFieldsDefinition deleteFields)
        {
            UpdateContentTypeResponseUpdateContentTypeResult result = new UpdateContentTypeResponseUpdateContentTypeResult();

            result = this.service.UpdateContentType(contentTypeId, contentTypeProperties, newFields, updateFields, deleteFields);

            this.ValidateUpdateContentType();
            this.CaptureTransportRelatedRequirements();

            return result;
        }
コード例 #7
0
 /// <remarks/>
 public void UpdateContentTypeAsync(string listName, string contentTypeId, UpdateContentTypeContentTypeProperties contentTypeProperties, AddOrUpdateFieldsDefinition newFields, AddOrUpdateFieldsDefinition updateFields, DeleteFieldsDefinition deleteFields, string addToView, object userState)
 {
     if ((this.UpdateContentTypeOperationCompleted == null))
     {
         this.UpdateContentTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateContentTypeOperationCompleted);
     }
     this.InvokeAsync("UpdateContentType", new object[] {
             listName,
             contentTypeId,
             contentTypeProperties,
             newFields,
             updateFields,
             deleteFields,
             addToView}, this.UpdateContentTypeOperationCompleted, userState);
 }
コード例 #8
0
        /// <summary>
        /// Generate updateFields parameter with specified newFieldOption.
        /// </summary>
        /// <returns>The value of updateFields parameter.</returns>
        protected AddOrUpdateFieldsDefinition GenerateUpdateFields()
        {
            AddOrUpdateFieldsDefinition addOrUpdateFieldsDefinition = new AddOrUpdateFieldsDefinition();
            addOrUpdateFieldsDefinition.Fields = new AddOrUpdateFieldsDefinitionMethod[1];
            addOrUpdateFieldsDefinition.Fields[0] = new AddOrUpdateFieldsDefinitionMethod();
            addOrUpdateFieldsDefinition.Fields[0].ID = this.newFieldsID;

            addOrUpdateFieldsDefinition.Fields[0].Field = new AddOrUpdateFieldDefinition();
            addOrUpdateFieldsDefinition.Fields[0].Field.ID = this.newFieldID;
            addOrUpdateFieldsDefinition.Fields[0].Field.Name = this.GenerateRandomString(10);

            return addOrUpdateFieldsDefinition;
        }
コード例 #9
0
 /// <remarks/>
 public System.IAsyncResult BeginUpdateContentType(string listName, string contentTypeId, UpdateContentTypeContentTypeProperties contentTypeProperties, AddOrUpdateFieldsDefinition newFields, AddOrUpdateFieldsDefinition updateFields, DeleteFieldsDefinition deleteFields, string addToView, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("UpdateContentType", new object[] {
             listName,
             contentTypeId,
             contentTypeProperties,
             newFields,
             updateFields,
             deleteFields,
             addToView}, callback, asyncState);
 }
コード例 #10
0
 /// <remarks/>
 public void UpdateContentTypeAsync(string listName, string contentTypeId, UpdateContentTypeContentTypeProperties contentTypeProperties, AddOrUpdateFieldsDefinition newFields, AddOrUpdateFieldsDefinition updateFields, DeleteFieldsDefinition deleteFields, string addToView)
 {
     this.UpdateContentTypeAsync(listName, contentTypeId, contentTypeProperties, newFields, updateFields, deleteFields, addToView, null);
 }
コード例 #11
0
 public UpdateContentTypeResponseUpdateContentTypeResult UpdateContentType(string listName, string contentTypeId, UpdateContentTypeContentTypeProperties contentTypeProperties, AddOrUpdateFieldsDefinition newFields, AddOrUpdateFieldsDefinition updateFields, DeleteFieldsDefinition deleteFields, string addToView)
 {
     object[] results = this.Invoke("UpdateContentType", new object[] {
             listName,
             contentTypeId,
             contentTypeProperties,
             newFields,
             updateFields,
             deleteFields,
             addToView});
     return ((UpdateContentTypeResponseUpdateContentTypeResult)(results[0]));
 }
コード例 #12
0
 /// <remarks/>
 public void CreateContentTypeAsync(string listName, string displayName, string parentType, AddOrUpdateFieldsDefinition fields, CreateContentTypeContentTypeProperties contentTypeProperties, string addToView, object userState)
 {
     if ((this.CreateContentTypeOperationCompleted == null))
     {
         this.CreateContentTypeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateContentTypeOperationCompleted);
     }
     this.InvokeAsync("CreateContentType", new object[] {
             listName,
             displayName,
             parentType,
             fields,
             contentTypeProperties,
             addToView}, this.CreateContentTypeOperationCompleted, userState);
 }
コード例 #13
0
 /// <remarks/>
 public void CreateContentTypeAsync(string listName, string displayName, string parentType, AddOrUpdateFieldsDefinition fields, CreateContentTypeContentTypeProperties contentTypeProperties, string addToView)
 {
     this.CreateContentTypeAsync(listName, displayName, parentType, fields, contentTypeProperties, addToView, null);
 }
コード例 #14
0
 /// <remarks/>
 public System.IAsyncResult BeginCreateContentType(string listName, string displayName, string parentType, AddOrUpdateFieldsDefinition fields, CreateContentTypeContentTypeProperties contentTypeProperties, string addToView, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("CreateContentType", new object[] {
             listName,
             displayName,
             parentType,
             fields,
             contentTypeProperties,
             addToView}, callback, asyncState);
 }
コード例 #15
0
 public string CreateContentType(string listName, string displayName, string parentType, AddOrUpdateFieldsDefinition fields, CreateContentTypeContentTypeProperties contentTypeProperties, string addToView)
 {
     object[] results = this.Invoke("CreateContentType", new object[] {
             listName,
             displayName,
             parentType,
             fields,
             contentTypeProperties,
             addToView});
     return ((string)(results[0]));
 }