SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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

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

Your Answer


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.