문제

When I am querying lists items via SPSiteDataQuery by ServerTemplate, it returns items:

SPSiteDataQuery query = new SPSiteDataQuery();
query.Lists = "<Lists ServerTemplate=\"107\"/>";
query.ViewFields = "<FieldRef Name=\"Title\"/>";
query.Query = "<OrderBy><FieldRef Name=\"Title\"/>";
query.Webs = "<Webs Scope=\"SiteCollection\"/>";

DataTable dt = web.GetSiteData(query);

But when I replace Lists condition to "<Lists><List ID=\"" + listId + "\" /></Lists>" it returns empty datatable.

listId is correct, List exists in child site of web.

Where I am wrong?

도움이 되었습니까?

해결책

On possible issue is with Null Values in the Title field. So try changing ViewFields as follows

query.ViewFields = "<FieldRef Name='Title' Nullable='True'/>";
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top