SharePoint column values contain extra ;# characters
There's this bug that interferes with the output开发者_StackOverflow社区 of data at my Silverlight 2.0 control. When users for eg., select a user from a SharePoint 2007 column field Person or Group, the output will be displayed as:
9;#Carol
orstring;#4/8/2011
(column field Date and Time)
How may I eliminate the additional characters passed in then?
Hotfixes didn't help much either.the ;#
is SharePoint's data separator. Its similar to a comma in a Comma Separated Values (CSV) file. You'll need to parse the data manually:
string[] parsedData = data.Split(new string[] { ";#" });
In the case of the Person or Group
field, the 9
is the User ID of the user.
Turns out that the problem lies with my source code, just edit it to the following:
return value.Substring(value.LastIndexOf(";#") + 2);
You should not use split
function. You should use SPFieldUserValue
as shown in this post
http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/94c04deb-c7d1-426f-bb2f-5c894457e2b6/
精彩评论