**我有一个名为“资源”的Sharepoint列表,并有如下所示的各种字段和与DataTable相同的返回值:
ID Title Role LoginName Enable[Yes/No]
1 Pranav Developer BW\PPB Yes
2 Rohit Tester BW\RW No
3 Sarang Account BW\SJ No
4 Amit Soft.Eng BW\AI Yes
4 Kunal Soft.Eng BW\KT Yes
**我的代码:
public static DataTable GetListData()
{
DataTable returnTable = null;
SPSite thisSite = null;
SPWeb thisWeb = null;
SPList thisList = null;
try
{
thisSite = new SPSite(siteLink);
thisWeb = thisSite.OpenWeb();
thisList = thisWeb.Lists["Resources"];
if (thisList.Items.Count > 0)
{
filterQuery = new SPQuery();
filterQuery.ViewFields = PopulateFieldsParameter("Title,Role,AddtionalRoles,Designation,LoginName,ClientBillable,NonBillable, EnableChatting,LoggedIn,EnableTimesheet,DesignationTitle,pmPODEnable");
returnTable = thisList.GetItems(filterQuery).GetDataTable();
}
returnTable = thisList.Items.GetDataTable();
}
return returnTable;
}
使用上面的代码,我能够检索整个列表数据,但我想获得其Enable为Yes的表(行)。
实际输出
ID Title Role LoginName Enable[Yes/No]
1 Pranav Developer BW\PPB Yes
2 Rohit Tester BW\RW No
3 Sarang Account BW\SJ No
4 Amit Soft.Eng BW\AI Yes
5 Kunal Soft.Eng BW\KT Yes
预期输出 -Condition =启用==是
ID Title Role LoginName Enable[Yes/No]
1 Pranav Developer BW\PPB Yes
4 Amit Soft.Eng BW\AI Yes
5 Kunal Soft.Eng BW\KT Yes
帮助.. !!
提前感谢。
答案 0 :(得分:0)