Created
November 3, 2012 17:17
-
-
Save vman/4008000 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CrossListQueryInfo query = new CrossListQueryInfo(); | |
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; | |
//Make sure to set this property as true. | |
query.UseCache = true; | |
CrossListQueryCache cache = new CrossListQueryCache(query); | |
//Make sure to use one of the overloads of the GetSiteData method which takes in the SPSite parameter | |
//and not the SPWeb parametre. | |
DataTable results = cache.GetSiteData(SPContext.Current.Site); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment