internal static SharepointPropertyDefinition[] PropertyDefinitionsToSharepointPropertyDefinitions(Schema schema, ICollection <PropertyDefinition> propDefs)
        {
            List <SharepointPropertyDefinition> list = new List <SharepointPropertyDefinition>(propDefs.Count);

            foreach (PropertyDefinition propDef in propDefs)
            {
                list.Add(SharepointPropertyDefinition.PropertyDefinitionToSharepointPropertyDefinition(schema, propDef));
            }
            return(list.ToArray());
        }
示例#2
0
        internal static object[] GetValuesFromCAMLView(Schema schema, XmlNode xmlNode, CultureInfo cultureInfo, IList <PropertyDefinition> propertyDefinitions)
        {
            object[] array = new object[propertyDefinitions.Count];
            string   str   = string.Empty;

            if (xmlNode.LocalName == "row")
            {
                str = "ows_";
            }
            int i = 0;

            while (i < propertyDefinitions.Count)
            {
                SharepointPropertyDefinition sharepointPropertyDefinition = SharepointPropertyDefinition.PropertyDefinitionToSharepointPropertyDefinition(schema, propertyDefinitions[i]);
                if (sharepointPropertyDefinition != null)
                {
                    string name = str + sharepointPropertyDefinition.SharepointName;
                    try
                    {
                        if (xmlNode.Attributes[name] == null || (array[i] = sharepointPropertyDefinition.FromSharepoint(xmlNode.Attributes[name].Value, cultureInfo)) == null)
                        {
                            array[i] = new PropertyError(propertyDefinitions[i], PropertyErrorCode.NotFound);
                        }
                        goto IL_DC;
                    }
                    catch (FormatException)
                    {
                        array[i] = new PropertyError(propertyDefinitions[i], PropertyErrorCode.CorruptData);
                        goto IL_DC;
                    }
                    goto IL_AC;
                }
                goto IL_AC;
IL_DC:
                i++;
                continue;
IL_AC:
                if (propertyDefinitions[i] is DocumentLibraryPropertyDefinition)
                {
                    array[i] = new PropertyError(propertyDefinitions[i], PropertyErrorCode.NotFound);
                    goto IL_DC;
                }
                array[i] = new PropertyError(propertyDefinitions[i], PropertyErrorCode.NotSupported);
                goto IL_DC;
            }
            return(array);
        }