SPSiteDataQuery
string where = @"<Where><Eq><FieldRef Name='AssignedTo' />
<Value Type='User'>" + username + "</Value></Eq></Where>";
SPSiteDataQuery query = new SPSiteDataQuery();
query.Webs = "<Webs Scope='SiteCollection'>";
query.Lists = "<Lists ListTemplate='107'/>";
query.ViewFields = "<FieldRef Name='Title' Type='Text'/>";
query.ViewFields += "<FieldRef Name='StartDate' />";
query.ViewFields += "<FieldRef Name='DueDate' />";
query.ViewFields += "<FieldRef Name='Status' />";
query.ViewFields += "<FieldRef Name='AssignedTo' Type='UserMulti' Nullable='TRUE' />";
query.ViewFields += "<FieldRef Name='PercentComplete' Type='Number' Nullable='TRUE' />";
query.ViewFields += "<FieldRef Name='Body' />";
query.Query = where;
DataTable dt = web.GetSiteData(query);
No comments:
Post a Comment