Hi,
I just started working with Sharepoint and was trying to access lists in a specified site. I got the following example off of the web but I'm getting an error. It seems I'm missing a reference to SPSite.
Here's the code:
Any suggestions as to why is not working? Thanks!
I just started working with Sharepoint and was trying to access lists in a specified site. I got the following example off of the web but I'm getting an error. It seems I'm missing a reference to SPSite.
Here's the code:
Code:
using System;
using Microsoft.SharePoint;
namespace SPLst
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
SPSite siteCollection = new SPSite("[URL unfurl="true"]http://spsdev/sites/andrest/default.aspx");[/URL]
SPWebCollection sites = siteCollection.AllWebs;
foreach (SPWeb site in sites)
{
SPListCollection lists = site.Lists;
Console.WriteLine("Site: " + site.Name + " Lists: " +
lists.Count.ToString());
}
Console.WriteLine("Press ENTER to continue");
Console.ReadLine();
}
}
}
Any suggestions as to why is not working? Thanks!