0

Whenever I do CAML queries for SharePoint list items I find that the return results always have strange characters in the value. For example, if I do a query against the filename (FileLeafRef) I will get a value such as this:

10;#Filename.JPG

Why does this happen and is there a standard best practice for handling these values to get only what I want?

1

SharePoint stores multiple value for several field types. Each of these fields has a type in the server object model that will parse out the compound values into their parts. The names of these types all start with SPField and end with Value.

Here are some examples:

  • Multi-select choice
    • Values separated by delimiter
    • ;#Value 1;#Value2;#Value 3;#
    • SPFieldMultiChoiceValue
  • Lookup and Person or Group
    • ID and value separated by delimiter
    • 42;#Rob Windsor
    • SPFieldLookupValue or SPFieldUserValue
  • Hyperlink or Picture

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.