471,312 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,312 software developers and data experts.

creating a SPFolder object using SOM

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;
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
0 2198

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Carlos Lozano | last post: by
16 posts views Thread by tshad | last post: by
4 posts views Thread by tshad | last post: by
17 posts views Thread by Lee Harr | last post: by
6 posts views Thread by wcc | last post: by
11 posts views Thread by Matthew Wells | last post: by
9 posts views Thread by =?Utf-8?B?YmJn?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.