public IndexFieldDefinition CreateIndexField(string label, string description, FolderIndexFieldType fieldType, Guid dropdownListId, Guid queryId, string queryDisplayField, string queryValueField, bool required, string defaultValue)
        {
            if (string.IsNullOrWhiteSpace(label))
            {
                throw new ArgumentException("label is required but was an empty string", "label");
            }

            dynamic postData = new ExpandoObject();
            postData.label = label;

            if (!String.IsNullOrWhiteSpace(description))
            {
                postData.Description = description;
            }

            postData.fieldType = fieldType;
            postData.dropdownListId = dropdownListId;
            postData.queryId = queryId;

            if (!String.IsNullOrWhiteSpace(queryValueField))
            {
                postData.queryValueField = queryValueField;
            }
            if (!String.IsNullOrWhiteSpace(queryDisplayField))
            {
                postData.queryDisplayField = queryDisplayField;
            }
            postData.required = required;

            if (!String.IsNullOrWhiteSpace(defaultValue))
            {
                postData.defaultValue = defaultValue;
            }

            return HttpHelper.Post<IndexFieldDefinition>(GlobalConfiguration.Routes.IndexFields, string.Empty, GetUrlParts(), this.ClientSecrets, this.ApiTokens, postData);
        }
예제 #2
0
        public IndexFieldDefinition CreateIndexField(string label, string description, FolderIndexFieldType fieldType, Guid dropdownListId, Guid queryId, string queryDisplayField, string queryValueField, bool required, string defaultValue)
        {
            if (string.IsNullOrWhiteSpace(label))
            {
                throw new ArgumentException("label is required but was an empty string", "label");
            }

            dynamic postData = new ExpandoObject();

            postData.label = label;

            if (!String.IsNullOrWhiteSpace(description))
            {
                postData.Description = description;
            }

            postData.fieldType      = fieldType;
            postData.dropdownListId = dropdownListId;
            postData.queryId        = queryId;

            if (!String.IsNullOrWhiteSpace(queryValueField))
            {
                postData.queryValueField = queryValueField;
            }
            if (!String.IsNullOrWhiteSpace(queryDisplayField))
            {
                postData.queryDisplayField = queryDisplayField;
            }
            postData.required = required;

            if (!String.IsNullOrWhiteSpace(defaultValue))
            {
                postData.defaultValue = defaultValue;
            }

            return(HttpHelper.Post <IndexFieldDefinition>(GlobalConfiguration.Routes.IndexFields, string.Empty, GetUrlParts(), this.ClientSecrets, this.ApiTokens, postData));
        }