Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

How to Access SharePoint's Database

  Asked By: Ricardo    Date: Nov 11    Category: Sharepoint    Views: 1944

I'm using Ms. SharePoint Portal Server 2001.

How can I access SharePoint's DB (using ASP) ?

Because I need to fetch document's property (I've made
a document profile).



4 Answers Found

Answer #1    Answered By: Lonnie Cohen     Answered On: Nov 11

You may need to use the SDK................

Answer #2    Answered By: Ruchir Satam     Answered On: Nov 11

You have to use ADO objects to access  the document profiles. Here comes the
sample code.

Following code displayed recent five documents from the doc library

On error resume next
Dim strContent
Dim conn
Dim cmd
Dim RS
Dim iDaysOffset
iDaysOffset =5
Set conn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
Set RS = CreateObject("ADODB.RecordSet")

conn.ConnectionString = "provider=msdaipp.dso"
conn.CommandTimeout = 0
conn.Open "http://trbsrpt01/CRCKM",Request.ServerVariables("REMOTE_USER")
set cmd.ActiveConnection = conn
cmd.CommandText = "select ""DAV:href"",
""DAV:getlastmodified"" from scope('deep traversal of
""http://trbsrpt01/CRCKM/Documents/Legal""') where
(""DAV:contentclass""<>'urn:content-classes:smartfolder') AND
(""DAV:href"" NOT LIKE '%Templates%') AND (""DAV:creationdate"">=
DateAdd(DAY,-" & iDaysOffset & ",GetGMTDate())) Order by
""DAV:getlastmodified"" Desc"
RS.open cmd

If Rs.EOF or RS.EOF then

strContent = "<Table width=""100%""><TR
style=""font-size:12;font-face:Arial""> <td> No matching document(s)
getContent = strContent
Exit function
strContent = "<DIV style=""font-size: 12;""> <Table width=""100%""
border=""0"" valign=""top"">"
strContent = strContent & " <TR height=""1""><TD width=""55%""
align=""left""> <b> Title </b></Td>"
strContent = strContent & " <Td width=""2%""> &nbsp;</td>
<Td width=""20"" align=""left""><b> Author </b></Td>
<Td width=""23"" align=""left""><b> Date
Dim i, j
i = 0
' For j = 0 to 5
Do while not rs.eof
i = i + 1
strContent = strContent & "<TR
style=""font-size:12;font-face:Arial""> <td><a href=" &
RS("DAV:href") & " target='_blank'>" &
RS("urn:schemas-microsoft-com:office:office#Title") &
strContent = strContent & "<td>&nbsp;</td><td >"
& RS("urn:schemas-microsoft-com:office:office#DocumentAuthor") &
"</td><Td width=""20"" align=""left"">" &
FormatDateTime(RS("DAV:getlastmodified"), VBShortDate) &
'if RS.EOF or RS.BOF then
' Exit For
'End if
' Next
strContent = strContent & "</Table></DIV>"
End if
set RS = nothing
set cmd =nothing
set conn=nothing

Copy the above code in an .asp page and check running it and modify according to
your need.

Answer #3    Answered By: Suresh Chindarkar     Answered On: Nov 11

You need to use PKMCDO to do that...............

Answer #4    Answered By: Varun Mehta     Answered On: Nov 11

Why did I always get this error message when I use
PKMCDO with ASP? Is there something I need to
configure first?



Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/crawlmetadata.asp, line 3, column 10
Dim objCS As PKMCDO.KnowledgeStartAddress


Didn't find what you were looking for? Find more on How to Access SharePoint's Database Or get search suggestion and latest updates.