please help me find "Shared Documents" folder

please help me find "Shared Documents" folder

Post by TWVkZX » Sun, 18 Jun 2006 05:51:03


Hi,

I have been trying to get all files that located at "Shared Documents" at
"MySite", I have been working on it and teste many different ways but I have
failed everytime.

When I had installed just WSS it was easy and I find them by using following:

SPSite ISite = new SPSite("http://localhost");
SPWeb IWebSite = ISite.OpenWeb();
SPFolder IFolder = IWebSite.GetFolder("Shared Documents");
SPFileCollection IFiles = Folder.Files;

but know when i have installed SPS 2003 it is not folder any more (I think)
it is a list.

I have tested following but no success.

SPSite IMySite = new SPSite("http://localhost/MySite");
SPWeb ISite = IMySite.OpenWeb();
SPFolder doc = ISite.Folders["Lists"];

OR

SPListCollection lists = ISite.Lists;
foreach (SPList list in lists)
{
if (list.BaseType == SPBaseType.DocumentLibrary)
.....
}
 
 
 

please help me find "Shared Documents" folder

Post by S.S. Ahme » Sun, 18 Jun 2006 21:34:07

The following code is perfect and should work:

SPListCollection lists = ISite.Lists;
foreach (SPList list in lists)
{
if (list.BaseType == SPBaseType.DocumentLibrary)
.....
}

Just take care of one thing: ISite should point to the site that contains
"Shared Documents" list.

--SSA
http://www.yqcomputer.com/

 
 
 

please help me find "Shared Documents" folder

Post by TWVkZX » Mon, 19 Jun 2006 07:04:02

Thank you Ahmed,

but when i test lists.Count.ToString() I get zero, there is no list in
MySite, is it possible?
 
 
 

please help me find "Shared Documents" folder

Post by S.S. Ahme » Mon, 19 Jun 2006 23:39:13

If there are no lists in MySite, then count.toString() would return 0. Post
your code here so that i can check it.

SSA
http://www.yqcomputer.com/