locked
The property ViewFields contains an invalid value. RRS feed

  • Question

  • Hi ,
    i create one generic list and insert data into that now i try fetch that data using CAML Query .
    but i facing Error ie;
    The property ViewFields contains an invalid value.

    my codedd:

    query.Lists = "<Lists ServerTemplate=\"100\" />";

    query.ViewFields = "<ViewFields><FieldRef Name='Title' Nullable=\"TRUE\"/></ViewFields>";

    query.Query = "<OrderBy>" +
    "<FieldRef Name=\"Title\" Ascending=\"False\" />" + "</OrderBy>";
    query.Webs = "<Webs Scope=\"SiteCollection\"/>"; 

    dt=site.GetSiteData(query);

    Thanks,
    Mahdu.
    Monday, July 23, 2012 6:05 AM

Answers

  • Hi

    Directly pass the field info, remove <ViewFields></ViewFields> tags

    Ex

    query.ViewFields = "<FieldRef Name='Title' Nullable=\"TRUE\"/>";

    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact ravimca@live.com.

    Monday, July 23, 2012 6:32 AM