0

I have my Listinstance in Sisual Studio every time i Deploy the Guid Id changes to a new value

http://servername:22222/sites/test/_vti_bin/owssvr.dll?Cmd=ExportList&List=213123-1234124-124124--12412142124

We says its first time, next time i deploy it has other values in the ID , how should i solve this because i use an Spsitedataquery were i want to query my lists , there i specifie my listid but the id always changes how should i solve it?

1

Instead of specifying listID in Spsitedataquery specify List TemplateID

SPSiteDataQuery dataQuery = new SPSiteDataQuery();
                dataQuery.Webs = "<Webs Scope=\"SiteCollection\">";
                dataQuery.Lists = "<Lists ServerTemplate=\"10000\" />";
                dataQuery.ViewFields = "<FieldRef Name=\"Title\" />";
                string where ="<Where><Eq>";
                where += "<FieldRef Name=\"EmployeeID\"/>";
                where += "<Value Type='Integer'>" + txtEmpId.Text + "</Value>";
                where += "</Eq></Where>";

                dataQuery.Query = where;
                DataTable dt = web.GetSiteData(dataQuery);

Disadvantage:In this case you will be querying all the lists with ServerTemplate=10000.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.