开发者

Get UniqueId of a list item from SPMetal code

Quick question. I want to generate code with SPMetal that includes the UniqueId field (the field that has the GUID for the list item), but somehow in Visual Studio I end up with either:

  • A list without that field
  • A list that in theor开发者_运维百科y has that field (UniqueIdUniqueId.. why is it named that way?), but when I try to run it, throws me a NullException.

I'm using Sharepoint 2010, VS 2010.

Can you point me in the right direction? I'm stalled right now. I would paste you the XML file I've been using as parameters to SPMetal, but my servers are down right now. I'll post it ASAP, but if anyone has the answer on how to generate a class that includes that particular field, I'd be thankful.

Thanks!


The solution was: use the "GUID" hidden field. Duh.


I think is no way to include 'UniqueId', because is not a part of any content type.

If this realy need to get 'UniqueId', try write SQuery, which get item by ID with one viewField (to maximize performance).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜