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 am trying to find out the id for my list

SPSiteDataQuery query = new SPSiteDataQuery();
                query.Lists =
                    "<Lists><List ID=\"{0FF8BA49-E407-4039-8AF8-2579BCB0D3CD}\"/>" +
                    "<List ID=\"{1CA8AFFA-64E0-44F8-B09F-D7A799F23DD03}\"/></Lists>";

Like this , i Go in to my list press list and then list setting a copy the url and in the end of the url is the id for the list i change it like this....enter link description here and then insert in i the code above but every time i deploy my Visual Studio Solution and then go in to the url for the list the id has changed is that really the ID for the list? that i should put in the query above...

share|improve this question
add comment

1 Answer

If your Visual Studio solution (or a related solution) creates the list then there is also the chance that it destroys the list when the feature is retracted, which is normally part of SharePoint solution deployment. if so, then yes, the list ID would change every time. You will likely have to find the list based on URL and grab the GUID at run time. You could also store the list instance GUID somewhere during feature activation created and then just reference that when building your query.

There are other solutions, like this, but I suspect that is not applicable to what you are trying to do.

share|improve this answer
    
Oki so u mean that Mylistinstance do not need to be in My feature reciver for My site to work? –  Martin Jan 30 '13 at 0:05
    
No, I'm saying that if your feature is creating the list instance that is why the GUID keeps changing. Use the list instance url to open the list and then grab the guid there for your code –  Dave Wise Jan 30 '13 at 15:57
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.