Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        }                                            // 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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
        }