【发布时间】:2011-11-26 09:09:10
【问题描述】:
我在 sharepoint 中有一个员工列表。员工列表中的一列是名为组织的查找列。 我正在尝试编写一个 CAML 查询来获取组织值不为空的所有员工。但是,即使组织的值为空,我也会收到所有项目。 这就是我正在尝试的
string querystring = string.empty;
querystring = "<Where><IsNotNull><Field RefName='EmployeeOrganization_x0020_Organization' /></IsNotNull></Where>";
此查询返回列表中的所有项目。
SPQuery query = new SPQuery();
query.Query = "<Where><IsNotNull><FieldRef Name='EmployeeOrganization_x0020_Organization'/></IsNotNull></Where>";
DataTable dtemp = emplist.GetItems(query).GetDataTable();
if (dtemp != null)
{
GridView1.DataSource = dtemp ;
GridView1.DataBind();
}
【问题讨论】:
标签: sharepoint