TroubleShoot:分配对象查询的问题

一、问题:

在使用SPQuery的时候,CAML查询分配对象是当前帐号的时候,查不出来与自己相关的。

相关CAML如下:

string caml = "<Where><Eq>";
caml += "<FieldRef Name='AssignedTo' LookupId='True'/>";
caml += "<Value Type='User'>" + SPContext.Current.Web.CurrentUser.ID + "</Value>";
caml += "</Eq></Where>";
caml += "<OrderBy><FieldRef Name='Created' Ascending='False'/></OrderBy>";

发现SPContext.Current.Web.CurrentUser.ID和分配对象的ID不一样,所以找不到。

使用这个<UserID Type='Integer'/>就可以了
 

原文地址:https://www.cnblogs.com/windy2008/p/2317306.html