Question

following is my Query:-

SPSiteDataQuery oQuery = new SPSiteDataQuery();

oQuery.Lists = "<Lists ServerTemplate=\"171\" />";
oQuery.Query = string.Concat("<Where>",
                               "<Eq>",
                                 "<FieldRef Name='Status' />",
                                 "<Value Type='Choice'>Not Started</Value>",
                               "</Eq>",  
                             "</Where>");
oQuery.ViewFields = "<FieldRef Name=\"Title\" />" +  /* Title is LastName column </Today>*/
                      "<FieldRef Name=\"StartDate\"/>" +
                      "<FieldRef Name=\"DueDate\"/>" +
                      "<FieldRef Name=\"LinkTitle\"/>" +
                      "<FieldRef Name=\"Body\"/>" +
                      "<FieldRef Name=\"NewStarter\"/>" +
                      "<FieldRef Name=\"AssignedTo\"/>";
oQuery.Webs = "<Webs Scope=\"Recursive\" />";

I have 6 tasks lists in my SharePoint site. I can see tasks with status as 'Not Started' in the 6 task lists. However, in Visual Studio 2012, when I use CAML to query the tasks lists using ID as 171, I cannot see any tasks. Am I doing something wrong in my query?

Was it helpful?

Solution

I had the same issue, pls check which site you are reffering to. Debug the application and check which items are fetched.

Use your site.url property in visual studio during debug/add watch.

OTHER TIPS

You may be using wrong ServerTemplate. According to MSDN 107 is template id for Tasks. 171 is TasksWithTimelineAndHierarchy

Also: SPSiteDataQuery does not support UserMulti in the AssignedTo field.

See this: https://support.microsoft.com/en-us/kb/2703054

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top