Home > MOSS, SharePoint, spfolder > How to get a SPfolder based on FolderId

How to get a SPfolder based on FolderId


using (SPSite site = new SPSite("http://localhost"))
{
using (SPWeb web = site.OpenWeb())
{

// Get a folder by server-relative URL.
string url = web.ServerRelativeUrl + "/shared documents/myfolder";
SPFolder folder = web.GetFolder(url);

try
{

Guid id = folder.UniqueId;

// Get a folder by Guid.
folder = web.GetFolder(id);

}
catch (Exception ex)
{

}
}
}
Advertisements
Categories: MOSS, SharePoint, spfolder
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: