开发者

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 or
  • string;#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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜