string camlQuery = "<Where><Eq><FieldRef Name='User_x0020_Name'/><Value Type='User'>" + userDisplayName + "</Value></Eq></Where>";
SPList spList = spWeb.Lists["List Name"];
SPQuery spQuery = new SPQuery();
spQuery.Query = camlQuery;
SPListItemCollection listItemCollection = spList.GetItems(spQuery);
http://www.saturnvibes.com/SharepointProjectServer2007/post/2009/04/16/CAML-query-for-retrieving-ListItems-where-fieldType-is-User.aspx
No comments:
Post a Comment