Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Query to find number of documents in doc lib from all sites

  Asked By: Jill    Date: Sep 12    Category: Sharepoint    Views: 2679

We have a Windows Sharepoint Service 2.0 environment. we have more than
20-25 sites and subsites under one virtual directory. there are n
number of doucuments have been uploaded.

Now I have a problem of counting number of documents in the document
library which is above 20MB.

Can we run a query to find out this?



5 Answers Found

Answer #1    Answered By: Christop Mcfadden     Answered On: Sep 12

1, 2, 3, 4, 5...

Seriously, how do you want to count them?

Answer #2    Answered By: Gopal Jamakhandi     Answered On: Sep 12

We want to count the number  of documents  which has more than a size
of 50MB in the entire site structure. i.e. http://WSSTopSite. which
has more than 25 subsites  nested and having lot of document libraries.

I wanted to execute a query  or am planning to write object model
program to do that work..

What do you think is best?

Answer #3    Answered By: Chantal Rosa     Answered On: Sep 12

Iterate thru all the lists in the farm.
If the SPList can be cast as a document library, iterate thru the list items.
If the SPFile associated with the list item is > 50 MB, count it.

Answer #4    Answered By: Kyla Eckert     Answered On: Sep 12

But iteration method will not help to find  out complete count
in the site. because we dont know how many sites, how many folders
etc. we need to create a recursive method to find out a files and
folders. I feel this is bit lengthy and time consumming process.
anyway if anybody has some tectics to recursive the below requirement
let us know the same.

1. Open document library (dynamically).
2. Find out the number  of files in that document library.
3. If document library contains folders, enter inside the folder and
find out the number of files available in that folder.
4.Find out if there are any more folders.
5.If folders exist, repeat step 3.
6.Find out if there is anymore document library, if exist, repeat the
steps 1 to step 5.
7.This completes for one team site.
8.Iterate the same for all site.

Answer #5    Answered By: Alisha Holmes     Answered On: Sep 12

Um iteration will definentaly work. Just 'foreach' through each VS.