/// <summary> /// Gets fields list of specified object. /// </summary> /// <param name="objectTypeName">Object type name.</param> /// <param name="attribute">Field attribute flags.</param> /// <returns>List of fields.</returns> public List <FieldDescriptor> GetFields(string objectTypeName, FieldAttribute attribute = FieldAttribute.DontCare) { var result = new List <FieldDescriptor>(); if (CheckConnected()) { if (String.IsNullOrEmpty(objectTypeName)) { throw (new ArgumentNullException("objectTypeName")); } DescribeSObjectResult describeResult = _binding.describeSObject(objectTypeName); if (describeResult != null) { IEnumerable <Field> filteredFields = describeResult.fields; if (attribute != FieldAttribute.DontCare) { if (attribute.HasFlag(FieldAttribute.Custom)) { filteredFields = filteredFields.Where(f => f.custom); } if (attribute.HasFlag(FieldAttribute.Updatable)) { filteredFields = filteredFields.Where(f => f.updateable); } if (attribute.HasFlag(FieldAttribute.Filterable)) { filteredFields = filteredFields.Where(f => f.filterable); } } result = filteredFields.Select ( q => new FieldDescriptor() { Name = q.name, Type = q.type } ) .ToList(); } } return(result); }
internal Field[] GetFields(string sObjectType) { return(_sforceService.describeSObject(sObjectType).fields); }