I see code examples like this:
// get the current site
SPWeb site = SPControl.GetContextWeb(Context);
// set the library and view to display
string docLibName = "Shared Documents";
string viewName = "All Documents";
// get the folder
SPFolder docLibFolder = site.Folders[docLibName];
// get library and view
SPDocumentLibrary docLib = (SPDocumentLibrary)site.Lists[docLibName];
SPView docLibView = docLib.Views["View_Name"];
// get all the items in the folder
SPListItemCollection docLibItems = docLib.GetItemsInFolder(docLibView, docLibFolder);
// loop through and display the names of the items
foreach (SPListItem item in docLibItems){
Label1.Text += "Name: " + item["Name"] + "
";
}
And I dont really understand where the "Context" side of things come into it. Can anyone please help me out Im getting complier errors, what is "Context"
Thanks

dcument library help
Sai A
here is what I got:
SPSite site = new SPSite("http://server:12345/sites/Name/");
using (SPWeb web = site.OpenWeb())
{
string docLibName = "Shared Documents";
string viewName = "All Documents";
foreach (SPFolder f in web.Folders)
{
itemListLiteral.Text += "<b>" + f.Name + "</b><br />";
foreach (SPFile file in f.Files)
{
itemListLiteral.Text += " " + file.Name + "<br />";
}
}
}
as you can see its a different chunk of code, but it works in what I am trying to do...
But for some weird reason IIS seems to completely stops working (all website are stopped) after I run this code, would you or anyone know why that is
Mark See
I presume you are writing this code in a Windows Forms app or something
Context is used for webparts, so the code knows which sharepoint site it is running in. If you are using a Windows Forms app, it must be running on the server, and you'll need to supply the url of the sharepoint site. If your app is not running on the server, you'll need to use the sharepoint webservices.
Hope that helps
Nick
kiran1234
Can you please modify the code given or point me in the right direction to make the above code work in a code library project, or if that isnt possible, an ASP.NET 2.0 site may have to be used, which will be on the Sharepoint server as well...
Thanks for the help, I really need this stuff sorted out!
fya