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)
            {
              
            }
         }
     }

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *