public static SPCAMLQueryBuilder.FieldType GetAttributeType(Type t) { SPCAMLQueryBuilder.FieldType rc = SPCAMLQueryBuilder.FieldType.Unknown; // Get instance of the attribute. SharePointField MyAttribute = (SharePointField)Attribute.GetCustomAttribute(t, typeof(SharePointField)); if (MyAttribute != null) { rc = MyAttribute.FieldType; } return(rc); }
public static string GetPropertyName(string propertyName) { string rc = ""; PropertyInfo prop = typeof(SharePointDocument).GetProperty(propertyName); object[] attrs = prop.GetCustomAttributes(true); foreach (object attr in attrs) { SharePointField field = attr as SharePointField; if (field != null) { rc = field.FieldName; break; } } return(rc); }
} // Agreement, Invoice, License, Certificate public static string GetAttributeName(Type t) { string rc = ""; // Get instance of the attribute. SharePointField MyAttribute = (SharePointField)Attribute.GetCustomAttribute(t, typeof(SharePointField)); if (MyAttribute == null) { rc = ""; } else { rc = MyAttribute.FieldName; } return(rc); }
public static List <string> GetAllFieldNames() { List <string> fieldNames = new List <string>(); PropertyInfo[] props = typeof(SharePointDocument).GetProperties(); foreach (PropertyInfo prop in props) { object[] attrs = prop.GetCustomAttributes(true); foreach (object attr in attrs) { SharePointField field = attr as SharePointField; if (field != null) { string propFieldName = field.FieldName; fieldNames.Add(propFieldName); } } } return(fieldNames); }
public static SPCAMLQueryBuilder.FieldType GetFieldTypeByFieldName(string fieldName) { PropertyInfo[] props = typeof(SharePointDocument).GetProperties(); foreach (PropertyInfo prop in props) { object[] attrs = prop.GetCustomAttributes(true); foreach (object attr in attrs) { SharePointField field = attr as SharePointField; if (field != null) { string propFieldName = field.FieldName; if (propFieldName == fieldName) { SPCAMLQueryBuilder.FieldType fieldType = field.FieldType; return(fieldType); } } } } return(SPCAMLQueryBuilder.FieldType.Unknown); }