Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to fetch specific Document Set by name in C#

$
0
0

I have a document library in which I need to define new Document Set and upload some files in that Document Set.

This is the example by which I tried it:

http://mstechsharing.blogspot.com/2012/03/article-3-create-new-document-sets-and.html

But, in this line, I always get null when I try to get folder by name:

SPFolder myLibraryToUploadDocument = spWeb.Folders[documentLibraryName].SubFolders[txtTitle.Text];

I tried the existing folder and existing Document Set, but it never returns that folder, always null.

I with hardcoded name this ("MyDocSet" is existing Document Set):

SPFolder myLibraryToUploadDocument = spWeb.Folders[documentLibraryName].SubFolders["MyDocSet"];

When I try this, it returns all folders as collection:

SPList myList = spWeb.Lists["MyDocLibrary"];

myList.Folders;

How can I get my folder or Document Set by name??


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>