コード例 #1
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);
        }
コード例 #2
0
        /// <summary>
        /// Generate newField parameter with specified newFieldOption.
        /// </summary>
        /// <returns>The value of newField for update operation.</returns>
        protected AddOrUpdateFieldsDefinition GenerateNewFieldsForUpdate()
        {
            AddOrUpdateFieldsDefinition addOrUpdateFieldsDefinition = new AddOrUpdateFieldsDefinition();

            addOrUpdateFieldsDefinition.Fields               = new AddOrUpdateFieldsDefinitionMethod[1];
            addOrUpdateFieldsDefinition.Fields[0]            = new AddOrUpdateFieldsDefinitionMethod();
            addOrUpdateFieldsDefinition.Fields[0].ID         = Guid.NewGuid().ToString();
            addOrUpdateFieldsDefinition.Fields[0].Field      = new AddOrUpdateFieldDefinition();
            addOrUpdateFieldsDefinition.Fields[0].Field.ID   = this.newFieldID;
            addOrUpdateFieldsDefinition.Fields[0].Field.Name = this.GenerateRandomString(10);

            return(addOrUpdateFieldsDefinition);
        }
コード例 #3
0
        /// <summary>
        /// Create a ContentType.
        /// </summary>
        /// <param name="contentTypeDisplayName">Display name will store in server.</param>
        /// <returns>The Id of created content type.</returns>
        protected string CreateContentType(string contentTypeDisplayName)
        {
            this.ContentTypeType.ContentType             = new ContentTypePropertyDefinition();
            this.ContentTypeType.ContentType.Description = this.contentTypeDescription;
            this.ContentTypeType.ContentType.Title       = this.contentTypeTypeTitle;

            AddOrUpdateFieldsDefinition fields = this.GenerateNewFields();

            // Create a new content type on the context site.
            string contentTypeId = Adapter.CreateContentType(contentTypeDisplayName, Common.GetConfigurationPropertyValue("CreateContentType_ValidateContentType", this.Site), fields, this.ContentTypeType);

            return(contentTypeId);
        }
コード例 #4
0
        /// <summary>
        /// Generate newField parameter with specified newFieldOption.
        /// </summary>
        /// <returns>The value of newField parameter.</returns>
        protected AddOrUpdateFieldsDefinition GenerateNewFields()
        {
            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.newFieldName;

            return(addOrUpdateFieldsDefinition);
        }
コード例 #5
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);
        }