vincent the cat

Hey

Is there a way to get a list of all lists in every site and web in a virtual server (using WSS 3)

From what I could see, I can get the list of web from Webs.GetWebCollection() method and a list of lists from the SiteData.GetListCollection(out lists) method, but I can't see how to combine these in orde to get all the lists. Also, how do I get a reference to other sites in the virtual server What I'm most interrested in is the MySite site.

Thanks,

/V


Re: SharePoint - Development and Programming Lists in all sites

vincent the cat

Has anyone any ideas how to do that Or is the WSS 3 API simply that limited it wouldn't let you get all lists in all webs

/V




Re: SharePoint - Development and Programming Lists in all sites

gitome

i got all lists by iterating through the webs, starting at the root:

Dim _Rootweb As SPWeb = SPControl.GetContextSite(Context).RootWeb

For Each SPWeb _subweb in _Rootweb.webs

For Each SPList list In _subweb.Lists

....store your list stuff...

next

For Each SPWeb _subsubWeb in _subweb.webs

..... and so on

I hope this helped.

greetings





Re: SharePoint - Development and Programming Lists in all sites

vgkusuma

Hello Vincent,

I am trying to do the same thing: get a list of all lists in all sites using the WSS webservices. Were you able to do this Could you please share your solution

Thanks,

Kusuma





Re: SharePoint - Development and Programming Lists in all sites

Chase M

Hi Kusuma, I recently had to do this for a project I'm working on.

I first used the Webs web service's GetAllSubWebCollection method to get a list of all the sub webs.

Using the response from this method I iterated through each web and used the Lists web service's GetListCollection method to return a list of all lists on the web.

The trick was to change the Url property of the Lists web service to reflect the url of the web for each iteration.

Hope that helps,

- Chase





Re: SharePoint - Development and Programming Lists in all sites

Curtis Ruppe

When using the WSS 3.0 SDK you can use the following code to enumerate through the current site collection.

Code Snippet

using Microsoft.SharePoint;

using Microsoft.SharePoint.WebControls;

private List<SPList> _spLists = new List<SPList>();

public List<SPList> GetLists(HttpContext Context)

{

SPSite spsCurrent = SPControl.GetContextSite(Context);

GetWebs(spsCurrent.RootWeb);

return _spLists;

}

private void GetWebs(SPWeb spwCurrent)

{

spwCurrent.Lists.ListsForCurrentUser = true;

foreach(SPList spl in spwCurrent.Lists)

_spLists.Add(spl);

foreach(SPWeb spw in spwCurrent.GetSubwebsForCurrentUser())

GetWebs(spw);

}

A Web Service call gets a little more tricky and less efficient, as you would be constantly connecting back to the server for your recursion. It would be better to create your Web Service using the code above as a guideline. Good luck!





Re: SharePoint - Development and Programming Lists in all sites

vgkusuma

Hello Chase, Your suggestion did the trick. Thank You very much! Do you happen to know of any available Java library for invoking the WSS webservices

Regards,

Kusuma