none
Bug report - Client Object Model: Lists with a column named 'Folder'

    General discussion

  • This is an easy to reproduce bug. It is present in SP2010 as well as SP2013.

    1. Create a list and add a column with internal name "Folder", of type single line of text.
    2. Create an item and set a value for that field.
    3. Attempt to load that item specifically or via a CAML query using the Client Object Model.

    Expected result: The value is available in the FieldValues dictionary on the ListItem.

    SP2010 result: An exception is thrown: InvalidOperationException - The type of data at position 839 is different than the one expected.

    SP2013 results: 

    • When the field is included in the CAML query: The value is simply not present in the dictionary
    • When the field is explicitly loaded (context.Load(item, x => x["Folder"]);): An exception is thrown: ServerException - Invalid request.

    This is likely due to a serialization conflict with the "Folder" property of the ListItem class.

    Monday, November 12, 2012 6:08 PM

All replies

  • Just come across exactly the same problem.

    Microsoft I'll give you a nudge in the right direction.

    Microsoft.SharePoint.Client.ListItem

    protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                switch (peekedName)
                {
                    case "AttachmentFiles":
                        flag = true;
                        reader.ReadName();
                        base.UpdateClientObjectPropertyType("AttachmentFiles", this.AttachmentFiles, reader);
                        this.AttachmentFiles.FromJson(reader);
                        return flag;
    
                    case "ContentType":
                        flag = true;
                        reader.ReadName();
                        base.UpdateClientObjectPropertyType("ContentType", this.ContentType, reader);
                        this.ContentType.FromJson(reader);
                        return flag;
    
                    case "DisplayName":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["DisplayName"] = reader.ReadString();
                        return flag;
    
                    case "EffectiveBasePermissions":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["EffectiveBasePermissions"] = reader.Read<BasePermissions>();
                        return flag;
    
                    case "EffectiveBasePermissionsForUI":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["EffectiveBasePermissionsForUI"] = reader.Read<BasePermissions>();
                        return flag;
    
                    case "FieldValuesAsHtml":
                        flag = true;
                        reader.ReadName();
                        base.UpdateClientObjectPropertyType("FieldValuesAsHtml", this.FieldValuesAsHtml, reader);
                        this.FieldValuesAsHtml.FromJson(reader);
                        return flag;
    
                    case "FieldValuesAsText":
                        flag = true;
                        reader.ReadName();
                        base.UpdateClientObjectPropertyType("FieldValuesAsText", this.FieldValuesAsText, reader);
                        this.FieldValuesAsText.FromJson(reader);
                        return flag;
    
                    case "FieldValuesForEdit":
                        flag = true;
                        reader.ReadName();
                        base.UpdateClientObjectPropertyType("FieldValuesForEdit", this.FieldValuesForEdit, reader);
                        this.FieldValuesForEdit.FromJson(reader);
                        return flag;
    
                    case "File":
                        flag = true;
                        reader.ReadName();
                        base.UpdateClientObjectPropertyType("File", this.File, reader);
                        this.File.FromJson(reader);
                        return flag;
    
                    case "FileSystemObjectType":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["FileSystemObjectType"] = reader.ReadEnum<FileSystemObjectType>();
                        return flag;
    
                    case "Folder":
                        flag = true;
                        reader.ReadName();
                        base.UpdateClientObjectPropertyType("Folder", this.Folder, reader);
                        this.Folder.FromJson(reader);
                        return flag;
    
                    case "Id":
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Id"] = reader.ReadInt32();
                        return flag;
    
                    case "ParentList":
                        flag = true;
                        reader.ReadName();
                        base.UpdateClientObjectPropertyType("ParentList", this.ParentList, reader);
                        this.ParentList.FromJson(reader);
                        return flag;
                }
            }
            return flag;
        }
    


    Friday, January 25, 2013 1:57 PM