Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

How many documents in workspace?

  Asked By: Ganesh    Date: Oct 04    Category: Sharepoint    Views: 1099

For SharePoint V1, is there a script or web part that I can use to get a count
of how many documents are located in the document library for a workspace?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Devon Welch     Answered On: Oct 04

Here is my script  for that. This script generates comma separated values (CSV)
output.

Option Explicit

const adModeRead = 1
Const adModeReadWrite = 3
Const adFailIfNotExists = -1
Const adCreateNonCollection = 0

dim nsp,totvers,totbyte,tothf,prev,peruser,baze,url,publ,ow,hossz,vid,z,oa
dim insp
dim pg
dim txtAnimalID
dim cboKeepers
Dim konnektion
Dim rst
Dim strSQL

sub kollektor(urlqueryfld)

Set konnektion = CreateObject("ADODB.Connection")

konnektion.Provider = "MSDAIPP.DSO"
konnektion.Open urlQueryFld

strSQL="SELECT "
strSQL = strsql & "" &
AddQuotes("urn:schemas-microsoft-com:publishing:BaseDoc")
strSQL = strsql & "," & AddQuotes("DAV:href")
strSQL = strsql & "," &
AddQuotes("urn:schemas-microsoft-com:publishing:publishedby")
'
strSQL = strsql & "," & AddQuotes("DAV:getcontentlength")
strSQL = strsql & "," &
AddQuotes("urn:schemas-microsoft-com:publishing:FriendlyVersionID")
'
strSQL = strSQL & " FROM SCOPE('DEEP TRAVERSAL OF " & AddQuotes(urlQueryFld) &
"')"
strSQL=strSQL & " ORDER BY " &
AddQuotes("urn:schemas-microsoft-com:publishing:publishedby") & " DESC"
Set rst = CreateObject("ADODB.Recordset")
rst.Open strSQL, konnektion
if not rst.eof then
totvers=0
totbyte=0
tothf=0
prev="x"
peruser=1
'wscript.echo rst(0)
wscript.echo urlqueryfld
wscript.echo " "
wscript.echo "User, number of docs"
while not rst.EOF
baze=rst.Fields("urn:schemas-microsoft-com:publishing:BaseDoc")
if baze<>"" Then
url=rst.Fields("DAV:href")
'set oKD = CreateObject("CDO.KnowledgeDocument")
'oKD.DataSource.Open url,Nothing, adModeRead
'set oFs = oKD.Fields
'c = oFs.Count
'ow=ofs.item("urn:schemas-microsoft-com:publishing:owner")
'publ=ofs.item("urn:schemas-microsoft-com:publishing:publishedby")
'hossz=ofs.item("DAV:getcontentlength")
'vid=ofs.item("urn:schemas-microsoft-com:publishing:FriendlyVersionID")
'
publ=rst.Fields("urn:schemas-microsoft-com:publishing:publishedby")
ow=publ
hossz=rst.Fields("DAV:getcontentlength")
vid=rst.Fields("urn:schemas-microsoft-com:publishing:FriendlyVersionID")
'
if prev<>ow Then
prev=ow
wscript.echo ow & "," & peruser
tothf=tothf+peruser
peruser=1
end if
z=Clng(hossz)
totbyte=totbyte+z
peruser=peruser+1
'
'set okd=nothing
'
end if
rst.MoveNext
wend
wscript.echo " "
wscript.echo "Total files," & tothf
wscript.echo "Total versions," & totvers
wscript.echo "Total bytes," & totbyte
wscript.echo " "
rst.Close
Set rst = Nothing
else
wscript.echo "this should not be displayed"
end if
konnektion.Close
Set konnektion = Nothing
end sub

Public Function AddQuotes(strValue)
Const QUOTE = """"
AddQuotes = QUOTE & Replace(strValue, QUOTE, QUOTE & QUOTE) & QUOTE
End Function

set oa = CreateObject("CDO.KnowledgeDocument")
oa.DataSource.Open "http://nissps/teszt/Documents/Test_here",Nothing,
adModeReadWrite,adFailIfNotExists,,"NISSPS\taskholder","password"
'

 
Answer #2    Answered By: Sridhar Tantry     Answered On: Oct 04

I changed the settings for our workspaces and account but I get an erorr
message when trying to run the script
(47, 4) ADODB.Recordset: Item cannot be found in the collection corresponding to
the requested name or ordinal

Line 47 is baze=rst.Fields("urn:schemas-microsoft-com:publishing:BaseDoc")

Any ideas?

 
Didn't find what you were looking for? Find more on How many documents in workspace? Or get search suggestion and latest updates.




Tagged: