/// <summary>
        /// The UpdateList operation is used to update list properties and add, remove, or update fields.
        /// </summary>
        /// <param name="listName">The name of the list which will be updated</param>
        /// <param name="listProperties">The properties of the specified list</param>
        /// <param name="newFields">new fields to be added to the list</param>
        /// <param name="updateFields">the fields to be updated in the list</param>
        /// <param name="deleteFields">the fields to be deleted from the list.</param>
        /// <param name="listVersion">A string represents an integer value that specifies the current version of the list</param>
        /// <returns>UpdateList Result</returns>
        public UpdateListResponseUpdateListResult UpdateList(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion)
        {
            this.Site.Assert.IsNotNull(this.listsProxy, "The Proxy instance should not be NULL. If assert failed, the adapter need to be initialized");

            UpdateListResponseUpdateListResult result = null;
            try
            {
                result = this.listsProxy.UpdateList(listName, listProperties, newFields, updateFields, deleteFields, listVersion);

                // Verify the requirements of the UpdateList operation.
                this.VerifyUpdateListOperation(result);

                // Verify the requirements of the transport.
                this.VerifyTransportRequirements();
            }
            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 method is used to construct UpdateListFieldsRequest instance for UpdateList operation's add fields parameter.
        /// </summary>
        /// <param name="fieldNames">A parameter represents the fields to be added.</param>
        /// <param name="fieldTypes">A parameter represents the field types to be added.</param>
        /// <param name="isRequired">A parameter represents the whether added field required or not.</param>
        /// <param name="viewNames">A parameter represents the view to which the field should be added. If it is null, the field will not be added to any view. If it is empty string, the field will be added to default view</param>
        /// <returns>This method will return the UpdateListFieldsRequest instance.</returns>
        private static UpdateListFieldsRequest CreateAddListFieldsRequest(List<string> fieldNames, List<string> fieldTypes, bool isRequired, List<string> viewNames)
        {
            UpdateListFieldsRequest newFields = new UpdateListFieldsRequest();
            newFields.Fields = new UpdateListFieldsRequestFields();
            newFields.Fields.Method = new UpdateListFieldsRequestFieldsMethod[fieldNames.Count];

            for (int i = 0; i < fieldNames.Count; i++)
            {
                newFields.Fields.Method[i] = new UpdateListFieldsRequestFieldsMethod();
                newFields.Fields.Method[i].ID = Guid.NewGuid().ToString();
                newFields.Fields.Method[i].Field = new FieldDefinition();
                newFields.Fields.Method[i].Field.Name = fieldNames[i];
                newFields.Fields.Method[i].Field.DisplayName = fieldNames[i];
                newFields.Fields.Method[i].Field.Type = fieldTypes[i];
                newFields.Fields.Method[i].Field.Required = isRequired == true ? "TRUE" : "FALSE";
                newFields.Fields.Method[i].AddToView = viewNames[i];
            }

            return newFields;
        }
        /// <summary>
        /// This method is used to construct UpdateListFieldsRequest instance for UpdateList operation's delete fields parameter.
        /// </summary>
        /// <param name="fieldNames">A parameter represents the fields to be deleted.</param>
        /// <returns>The UpdateListFieldsRequest instance.</returns>
        public static UpdateListFieldsRequest CreateDeleteListFieldsRequest(List<string> fieldNames)
        {
            UpdateListFieldsRequest newFields = new UpdateListFieldsRequest();
            newFields.Fields = new UpdateListFieldsRequestFields();
            newFields.Fields.Method = new UpdateListFieldsRequestFieldsMethod[fieldNames.Count];

            for (int i = 0; i < fieldNames.Count; i++)
            {
                newFields.Fields.Method[i] = new UpdateListFieldsRequestFieldsMethod();
                newFields.Fields.Method[i].ID = Guid.NewGuid().ToString();
                newFields.Fields.Method[i].Field = new FieldDefinition();
                newFields.Fields.Method[i].Field.Name = fieldNames[i];
            }

            return newFields;
        }
        /// <summary>
        /// A method used to update list properties and add, remove, or update fields.
        /// </summary>
        /// <param name="listName">A parameter represents the name of the list which will be updated.</param>
        /// <param name="listProperties">A parameter represents the properties of the specified list.</param>
        /// <param name="newFields">A parameter represents new fields which are added to the list.</param>
        /// <param name="updateFields">A parameter represents the fields which are updated in the list.</param>
        /// <param name="deleteFields">A parameter represents the fields which are deleted from the list.</param>
        /// <param name="listVersion">A parameter represents an integer format string that specifies the current version of the list.</param>
        /// <returns>A return value represents the actual update result.</returns>
        public UpdateListResponseUpdateListResult UpdateList(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion)
        {
            if (null == this.listsProxy)
            {
                throw new InvalidOperationException("The Proxy instance is NULL, need to initialize the adapter");
            }

            UpdateListResponseUpdateListResult result = null;

            result = this.listsProxy.UpdateList(listName, listProperties, newFields, updateFields, deleteFields, listVersion);

            this.VerifyTransportRequirement();
            return result;
        }
Exemplo n.º 5
0
 /// <remarks/>
 public void UpdateListAsync(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion, object userState)
 {
     if ((this.UpdateListOperationCompleted == null))
     {
         this.UpdateListOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateListOperationCompleted);
     }
     this.InvokeAsync("UpdateList", new object[] {
             listName,
             listProperties,
             newFields,
             updateFields,
             deleteFields,
             listVersion}, this.UpdateListOperationCompleted, userState);
 }
Exemplo n.º 6
0
 /// <remarks/>
 public void UpdateListAsync(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion)
 {
     this.UpdateListAsync(listName, listProperties, newFields, updateFields, deleteFields, listVersion, null);
 }
Exemplo n.º 7
0
 /// <remarks/>
 public System.IAsyncResult BeginUpdateList(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("UpdateList", new object[] {
             listName,
             listProperties,
             newFields,
             updateFields,
             deleteFields,
             listVersion}, callback, asyncState);
 }
Exemplo n.º 8
0
 public UpdateListResponseUpdateListResult UpdateList(string listName, UpdateListListProperties listProperties, UpdateListFieldsRequest newFields, UpdateListFieldsRequest updateFields, UpdateListFieldsRequest deleteFields, string listVersion)
 {
     object[] results = this.Invoke("UpdateList", new object[] {
             listName,
             listProperties,
             newFields,
             updateFields,
             deleteFields,
             listVersion});
     return ((UpdateListResponseUpdateListResult)(results[0]));
 }