/// <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; }
/// <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; }
/// <summary> /// Construct deleted fields for the UpdateContentType operation using the specified field names. /// </summary> /// <param name="fieldNames">The deleted field names.</param> /// <returns>The DeleteFieldsDefinition type instance used in the UpdateContentType operation.</returns> public static DeleteFieldsDefinition CreateDeleteContentTypeFields(params string[] fieldNames) { DeleteFieldsDefinition deleteFields = new DeleteFieldsDefinition(); deleteFields.Fields = new DeleteFieldsDefinitionMethod[fieldNames.Length]; for (int i = 0; i < fieldNames.Length; i++) { deleteFields.Fields[i] = new DeleteFieldsDefinitionMethod(); deleteFields.Fields[i].ID = Guid.NewGuid().ToString(); deleteFields.Fields[i].Field = new DeleteFieldDefinition(); deleteFields.Fields[i].Field.Name = fieldNames[i]; } return deleteFields; }
/// <summary> /// Get a list of fields to be deleted on the content type. /// </summary> /// <returns>The value of deleteField parameter.</returns> protected DeleteFieldsDefinition GenerateDeleteFieldsDefinition() { DeleteFieldsDefinition deleteFields = new DeleteFieldsDefinition(); deleteFields.Fields = new DeleteFieldsDefinitionMethod[1]; deleteFields.Fields[0] = new DeleteFieldsDefinitionMethod(); deleteFields.Fields[0].Field = new DeleteFieldDefinition(); deleteFields.Fields[0].ID = Guid.NewGuid().ToString(); deleteFields.Fields[0].Field.Name = this.GenerateRandomString(10); return deleteFields; }
/// <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); }
/// <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); }
/// <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); }
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])); }