日期:2010-06-13 浏览次数:21402 次
1,自定义一个内容类如:urn:contentclasses:document1
其中有自定义属性:Clicknumber
2,所建的文档的内容类定义为1的。
3,建立一个窗体注册
urn:schemas-microsoft-com:office:forms#contentclass 为1建立的urn:contentclasses:document1
urn:schemas-microsoft-com:office:forms#cmd 为*
urn:schemas-microsoft-com:office:forms#formurl 为chkopen.asp
urn:schemas-microsoft-com:office:forms#executeurl 为chkopen.asp
urn:schemas-microsoft-com:office:forms#binding server
4,list.asp
<%
Function AddQuotes(strValue)
Const QUOTE = """"
AddQuotes = _
QUOTE _
& Replace(strValue, QUOTE, QUOTE & QUOTE) _
& QUOTE
End Function
Dim cnn 'As ADODB.Connection
Dim rst 'As ADODB.Recordset
Dim urlFld 'As String
Dim strSQL 'As String
urlFld ="http://aaa.com/fld1/"
Set cnn = CreateObject("ADODB.Connection")
With cnn
.Provider = "exoledb.datasource"
.Open urlFld
End With
strSQL = "Select " & _
AddQuotes("DAV:displayname") & ", " & _
AddQuotes("DAV:contentclass") & ", " & _
AddQuotes("Clicknumber") & ", " & _
AddQuotes("DAV:href")
strSQL = strSQL & _
" FROM SCOPE('SHALLOW traversal of " & _
AddQuotes(urlFld) & "')"
strSQL = strSQL & _
" WHERE " & AddQuotes("DAV:contentclass") & _
" = 'urn:contentclasses:document1'"
strSQL = strSQL & _
" ORDER BY " & AddQuotes("DAV:displayname")
Set rst = CreateObject("ADODB.Recordset")
With rst
.Open strSQL, cnn
End With
response.Write "<table>"
Do Until rst.EOF
response.Write "<tr><td width=200>"
%>
<a href="../fld1/<%=rst.Fields("DAV:displayname")%>"></a>
<%
response.Write "</td></tr>"
rst.MoveNext
Loop
response.Write "</table>"
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
%>
5,chkopen.asp
<%
Dim rec
dim ii
Dim cnn
Dim strUrl
strDataUrl = request.querystring("dataurl")
Set cnn = CreateObject("adodb.connection")
With cnn
.Provider = "exoledb.datasource"
.Open strDataUrl
End With
Set rec = server.CreateObject("adodb.record")
rec.Open strDataUrl, cnn, 3 'adModeReadWrite
ii=rec.fields("Clicknumber")
rec.fields("Clicknumber")=ii+1
rec.fields.update
rec.close
%>
open item ........
运行list.asp
点击文件时调用chkopen.asp 使Clicknumber+1同时打开该文件.其URL由strDataUrl = request.querystring("dataurl")完成.