Skip to content

Instantly share code, notes, and snippets.

@vman
Created November 3, 2012 18:28
Show Gist options
  • Save vman/4008198 to your computer and use it in GitHub Desktop.
Save vman/4008198 to your computer and use it in GitHub Desktop.
SPSiteDataQuery query = new SPSiteDataQuery();
query.ViewFields = "<FieldRef Name=\"Title\" /><FieldRef Name=\"DueDate\" />";
query.Query = @"<Where>
<And>
<Eq>
<FieldRef Name='AssignedTo'/>
<Value Type='User'>" +
SPContext.Current.Web.CurrentUser.Name
+ @"</Value>
</Eq>
<Neq>
<FieldRef Name='Status'/>
<Value Type='Choice'>Completed</Value>
</Neq>
</And>
</Where>";
query.Lists = "<Lists ServerTemplate=\"107\" MaxListLimit=\"0\"/>"; //Tasks Lists
query.Webs = "<Webs Scope=\"Recursive\" />";
//query.RowLimit = 100;
PortalSiteMapProvider ps = PortalSiteMapProvider.CurrentNavSiteMapProviderNoEncode;
PortalWebSiteMapNode pNode = ps.FindSiteMapNode(curWeb.ServerRelativeUrl) as PortalWebSiteMapNode;
DataTable results = ps.GetCachedSiteDataQuery(pNode, query, SPContext.Current.Web);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment