views:

335

answers:

2

I wrote a routine to remove pounds and ids from sharepoint fields that worked flawlessy, since I found a field withouth ids and # (pound) signs.

I want to understand why sometimes the field is serialized with ids and pounds and sometimes not.

example:

ows_Author="23;#Paperino, Pippo"

or

ows_Author="Paperino, Pippo"
+7  A: 

The ';#' sequence is a separator. If you remove it, you are undoubtably breaking things in a nasty way.

The 23 is the ID, the "Paperino, Pippo" is the Value. Just like a dropdown list has value/text pairings. Sometimes it [the ID + separator] will be there, other times not. It depends on how the value is bound in the UI. If it is bound to a dropdown chooser (like "users on this site"), then it'll be a value/text pairing. If it is automatically filled in by sharepoint, like "modified by," then it highly likely to not have an ID prefix.

Make sense?

-Oisin

x0n
Yes make sense, thank you. I'm not breaking things up, since I'm only extracting text values from webservices.Thank you again, bye.
volothamp
+1  A: 

The lookup column (including security settings) stores the value in an [ID]#;[value] manner because it is possible to delete or rename the value in the lookup columns target.

This change means that storing the ID enables the field to lookup the correct [value] even if it changes in the lookup target list.

If the lookup target list has the item deleted, then the original value can be displayed despite the discrepancy.

Note that if the field is saved without the original lookup ID being valid, it will stored just the value as you have noted (e.g. ows_Author="Paperino, Pippo").

Nat