First you need to add reference to Microsoft.SharePoint.dll.
Here is sample code how you can access items inside document library:
using (SPSite site = new SPSite("SiteUrl"))
{
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
//documentCategories is list of doc library names on SPSite, so catName could be something like "Invoices"
foreach (string catName in documentCategories)
{
SPFolder folder = GetFolder(web, catName, processInstanceId, false);
if (folder.Exists)
{
//handle specific document...
foreach (SPFile file in folder.Files)
{
}
}
}
web.Close();
}
site.Close();
}
Well this is just basic to get you started. Take notice you have to have windows authentication and impersonation enabled inside your web page to access SPSite with actual user creadentials or you can impersonate specific user, what is not a good practice.
For more tech details visit:
SPSite
SPWeb
SPFile