By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

creating a SPFolder object using SOM

P: n/a
Hi All,
I have 3 questions here:
1) Problem creating a SPFolder object:
I am trying to create a SPFolder object for a document/picture library

using the following code with SOM
1 SPSite site = new SPSite(Url);
2 SPWeb web = site.OpenWeb();
3 SPListCollection listcol = web.Lists;
4
5 foreach(SPList list in listcol)
6 {
7 //if the list is a Document/Picture Library
8 SPFolder folder = web.Folders[list.Title];
//Code giving exception
9 }
It works fine for all the Document/Picture Libraries except the
libraries with an hyphen in the library name.
For example
The above code works fine for the libraries with name
"SharePointLibrary" but fails for the libraries with hyphen in the
name like "SharePoint-Library" and exception returned is "Value
does not fall within the expected range."
Is there any work around for this so that I am able to
create the SPFolder object for any library?
2) I would like to know whether there is a way that I can get the
Document/Picture Library URL using SOM ?
3) I would like to get the LeafName of a Document/Picture Library from

Docs table using SharePoint Object Model(SOM)?
I tried with DocumentLibrary's Title property. It is returning the
display name of the Library instead of its LeafName.
Any examples will be helpful
Thanks & Regards
Phani Kiran K

Jan 27 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.