Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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