Figures
Figure 5
Figure 5
Figure 5 Accessing WSS Data Programmatically
Dim connADO As New ADODB.Connection
Dim rsADO As New ADODB.Recordset
Dim recADO As New ADODB.Record
Dim sFolderPath as String

sFolderPath = "file://./backofficestorage/MyDomain.Com/mbx/Corky/"

 'Open ADO Connection
connADO.ConnectionString = sArticlesPath
connADO.Provider = "ExOledb.Datasource"
connADO.Open

 'Create recordset with Exchange based SQL
rsADO.Open "Select * From scope('shallow traversal of """ & _ 
      sFolderPath & """')", connADO

 'Traverse Recordset and print subjects of all e-mails    
Do While Not rsADO.EOF And Not rsADO.BOF
 'Open a record object to retrieve all properties
    recADO.Open CStr(rsADO.Fields("DAV:href")), connADO
    Debug.Print recADO.Fields("urn:schemas:httpmail:subject")
    recADO.Close
    rsADO.MoveNext
Loop
rsADO.Close
connADO.Close
Figure 6 Custom Content Schema
Sub Main()
    sPath = "file://./BackOfficeStorage/MyDomain.com/" _
             & "Public Folders/Articles/"
    sDefaultSchemaFolder = "file://./BackOfficeStorage/MyDomain.com/" & _
                           "public folders/non_ipm_subtree/schema/"
    sCustomSchemaFolder = sPath & "schema"
    sCustomSchema = "http://ecollege.com"
    

    connADO.ConnectionString ="file://./BackOfficeStorage/" _
                              & "MyDomain.com/public folders/"
    connADO.Provider = "ExOledb.Datasource"
    connADO.Open
    
    ReDim aFolderDefaultContentClass(1)
    aFolderDefaultContentClass(1) = "urn:content-classes:message"
    
    CreateFolder sPath, aFolderDefaultContentClass, "IPF.Note"
    CreateFolder sPath & "/schema", aFolderDefaultContentClass, "IPF.Note"
    
    recADO.Open sPath & "schema", connADO, adModeReadWrite, _
                adFailIfNotExists
    ReDim aCustomSchema(1)
    aCustomSchema(1) = sDefaultSchemaFolder
    recADO.Fields("urn:schemas-microsoft-com:exch-data:baseschema") _
        = aCustomSchema
    recADO.Fields.Update
    recADO.Close
        
    ReDim aDefaultInherit(2)
    aDefaultInherit(1) = "urn:content-classes:item"
    aDefaultInherit(2) = "urn:content-classes:message"
    
    CreateCustomSchemaPropertyDefinition "articlekeywords", _
       "string", False, True, False
    CreateCustomSchemaPropertyDefinition "articledifficulty", _
       "int", False, True, False
    CreateCustomSchemaPropertyDefinition "articlesummary", _
       "string", False, True, False
    CreateCustomSchemaPropertyDefinition "articlecodeurl", _
       "string", False, True, False
    ReDim aProperties(4)
    aProperties(1) = sCustomSchema & "articlekeywords"
    aProperties(2) = sCustomSchema & "articledifficulty"
    aProperties(3) = sCustomSchema & "articlesummary"
    aProperties(4) = sCustomSchema & "articlecodeurl"
    CreateCustomSchemaContentClass "articleitem", sCustomSchema & _
                     "content-classes:articleitem", _
                      aDefaultInherit, aProperties        
End Sub

Private Sub CreateCustomSchemaPropertyDefinition(sName as String, _
   sType as String, BMultiValued as Boolean, bIndexed as Boolean, _
   bReadOnly as Boolean)
   
 Dim recADO As New ADODB.Record
  
  recADO.Open sCustomSchemaFolder & "/" & sName, connADO, _ 
     adModeReadWrite, adCreateNonCollection + adCreateOverwrite
    recADO.Fields("DAV:contentclass") = "urn:content-classes:propertydef"
    recADO.Fields("urn:schemas-microsoft-com:xml-data#name").Value = _
                  sCustomSchema & sName
    recADO.Fields("urn:schemas-microsoft-com:datatypes#type").Value = sType
    recADO.Fields("urn:schemas-microsoft-com:exch-" _
                & "data:ismultivalued").Value = bMultiValued
    recADO.Fields("urn:schemas-microsoft-com:exch-data:" _
                & "isindexed").Value = bIndexed
    recADO.Fields("urn:schemas-microsoft-com:exch-data:" _ 
                & "isreadonly").Value = bReadOnly
    recADO.Fields.Update
    recADO.Close
End Sub

Private Sub CreateCustomSchemaContentClass(sName as String, _
                  sContentClassName as String, aInheritClasses _
                  as Variant, aCustomProperties as Variant)
    Dim recADO As New ADODB.Record
    recADO.Open sCustomSchemaFolder & "/" & sName, connADO, _
                  adModeReadWrite, adCreateNonCollection + _  
                  adCreateOverwrite
    recADO.Fields("urn:schemas-microsoft-com:xml-data#name").Value = _ 
       sContentClassName
    recADO.Fields("DAV:contentclass") = "urn:content-classes:: _  
                                        & "contentclassdef"
    recADO.Fields("urn:schemas-microsoft-com:xml-" _
                & "data#extends").Value = aInheritClasses
    recADO.Fields("urn:schemas-microsoft-com:xml-data#element") = _
       aCustomProperties
    recADO.Fields.Update
    recADO.Close
End Sub

Private Sub CreateFolder(sName as String, aDefaultContentClass as _ 
                         Variant, sMAPIFolderClass as String)

    Dim recADO As New ADODB.Record
    recADO.Open sName, connADO, adModeReadWrite, adCreateCollection
    recADO.Fields("DAV:contentclass").Value = "urn:content-classes:folder"
    recADO.Fields("http://schemas.microsoft.com/exchange/" _ 
                 & "outlookfolderclass") = sMAPIFolderClass

    recADO.Fields("urn:schemas-microsoft-com:exch-data:expected" _
                & "-content-class").Value = aDefaultContentClass
    recADO.Fields("urn:schemas-microsoft-com:exch-data:schema-" _
                & "collection-ref").Value = sCustomSchemaFolder

    recADO.Fields.Update
    recADO.Close

End Sub
Figure 7 Creating and Populating Custom Content Class
set oMsg = server.CreateObject("CDO.Message")
set connADO =  Server.CreateObject("ADODB.Connection")
connADO.ConnectionString = "file://./backofficestorage/MyDomain.com/" & _
                           "public folders/Articles"
connADO.Provider = "ExOledb.Datasource"
connADO.Open 
sCustomSchema = "http://ecollege.com"

oMsg.Fields("DAV:contentclass") = sCustomSchema _
     & "content-classes:articleitem"
oMsg.Fields(sCustomSchema & "articlekeywords") = "Exchange2000"
oMsg.Fields(sCustomSchema & "articlecodeurl") = "http://www.demos.com"
oMsg.Fields(sCustomSchema & "articledifficulty") = Cint(1)
oMsg.Fields(sCustomSchema & "articlesummary") = "summary goes here"
oMsg.Fields.Update
oMsg.TextBody = "Article Text Here"
oMsg.Subject = "Article Title Here"
oMsg.From = "Sean McCormick <corky@seanmccormick.com>"
oMsg.DataSource.SaveToContainer "file://./backofficestorage/" _ 
                              & "MyDomain.com/" _
                              & "public folders/Articles/"
Figure 8 Creating a Form Registration
sCustomSchema = "http://ecollege.com"
sCustomSchemaFolder = "file://./backofficestorage/MyDomain.com/public" _
                    & " folders/Articles/schema"

recADO.Open sCustomSchemaFolder & "/articleitem.reg", connADO, _  
   adModeReadWrite, adCreateNonCollection + adCreateOverwrite
'Set content class of registration type
recADO.Fields("DAV:contentclass") = _
   "urn:schemas-microsoft-com:office:forms#registration"
'set the form registration settings
recADO.Fields("urn:schemas-microsoft-com:office:forms#binding") =
   "server"
recADO.Fields("urn:schemas-microsoft-com:office:forms#browser") = "*"
recADO.Fields("urn:schemas-microsoft-com:office:forms#cmd") = ""
recADO.Fields("urn:schemas-microsoft-com:office:forms#contentclass") = _
   sCustomSchema & "content-classes:articleitem"
recADO.Fields("urn:schemas-microsoft-com:office:forms#contentstate") = _   
   "*"
recADO.Fields("urn:schemas-microsoft-com:office:forms#execute" _
            & "parameters") = "*"
recADO.Fields("urn:schemas-microsoft-com:office:forms#executeurl") = _
   "/Articles/ArticleItem.asp"
recADO.Fields("urn:schemas-microsoft-com:office:forms#formurl") = _
   "/Articles/ArticleItem.asp"
recADO.Fields("urn:schemas-microsoft-com:office:forms#language") = "*"
recADO.Fields("urn:schemas-microsoft-com:office:forms#majorver") = "*"
recADO.Fields("urn:schemas-microsoft-com:office:forms#messagestate") = _
   "*"
recADO.Fields("urn:schemas-microsoft-com:office:forms#minorver") = "*"
recADO.Fields("urn:schemas-microsoft-com:office:forms#platform") = "*"
recADO.Fields("urn:schemas-microsoft-com:office:forms#request") = "GET"
recADO.Fields("urn:schemas-microsoft-com:office:forms#version") = ""
recADO.Fields.Update
recADO.Close
Figure 9 Displaying Custom Properties
<HTML>
<BODY>

<%
sCustomSchema = "http://ecollege.com"

'Get the folder which the item is stored in
'    Retrieve for later use
sURL = request.querystring("dataurl")
For i = Len(sURL) to 1 Step -1
    if Mid(sURL,i,1) = "/" Then
        sURL = Left(sURL,i)
        Exit For
    End If
Next

'Traverse the querystring to see if it is in http:// format or 
'file:// format
'  Retrieve and save both formats for later use
if UCASE(Left(request.querystring("dataurl"),Len("http://Hoffa/"))) = _
   UCase("http://Hoffa/") Then
    sOfficeURL = "file://./backofficestorage/MyDomain.com/" & _
           Right(request.querystring("dataurl"), _
           Len(request.querystring("dataurl")) - Len("http://Hoffa/"))
    sHTTPURL = request.querystring("dataurl")

Else
    sOfficeURL = request.querystring("dataurl")
    sHTTPURL = "http://HOFFA/" & _
                   Right(request.querystring("dataurl"), _
                   Len(request.querystring("dataurl")) - _ 
                   Len("file://./backofficestorage/MyDomain.com/"))
End if

set oMsg = server.CreateObject("CDO.Message")
set rsADO = Server.CreateObject("ADODB.Recordset")
set recADO = Server.CreateObject("ADODB.Record")
set connADO = Server.CreateObject("ADODB.Connection")
connADO.ConnectionString = sOfficeURL
connADO.Provider = "ExOledb.Datasource"
connADO.Open

'Get Item into CDO object
oMsg.DataSource.Open sOfficeURL,connADO

    'Output item fields (inherited and custom)
Response.Write "<TABLE BORDER=0 CELLPADDING=5 CELLSPACING=0 WIDTH='100%'>"
Response.Write "<TR><TD COLSPAN=2><h2><B>" & oMsg.Subject & _
               "</B></H2></TD></TR>" & vbCRLF
Response.Write "<TR><TD COLSPAN=2><B>By </B>" & _
               oMsg.Fields("urn:schemas:httpmail:fromname") & _
               "</TD></TR>" & vbCRLF 
Response.Write "<TR><TD BGCOLOR=336699><FONT COLOR=FFFFFF>" _
             & "<B>Difficulty</B></FONT></TD><TD BGCOLOR=336699>" _ 
             & "<FONT COLOR=FFFFFF>" & oMsg.fields(sCustomSchema _  
             &  "articledifficulty") _
             &  "</FONT></TD></TR>" & vbCRLF
Response.Write "<TR><TD BGCOLOR=99CCFF><B>Download the code for" _
             & " this article: </B></FONT></TD><TD BGCOLOR=99CCFF>" _
             & "<A HREF=" & oMsg.fields(sCustomSchema & "articlecodeurl") _  
             & ">Click here to download</A></TD></TR>" & vbCRLF

Response.Write "<TR><TD><B>Summary</B></TD><TD>" & _
               oMsg.fields(sCustomSchema & "articlesummary") & _
               "</TD></TR>" & vbCRLF
Response.Write "<TR><TD COLSPAN=2><HR></TD></TR>" & vbCRLF
Response.Write "<TR><TD COLSPAN=2>" & oMsg.TextBody & "</TD></TR>" & vbCRLF
Response.Write "</TABLE>"
set oMsg = Nothing
connADO.Close
set connADO = Nothing
%>

</BODY>
</HTML>
Figure 11 WebDAV Example
Dim foo As New MSXML.XMLHTTPRequest
sProps = "<?xml version='1.0'?>"
sProps = strPropReq & "<d:propfind xmlns:d='DAV:'" _
                    & "xmlns:E='urn:schemas:httpmail:'>"
sProps = sProps & "<d:prop>"
sProps = sProps & "<E:subject/>"
sProps = sProps & "<E:fromname/>"
sProps = sProps & "</d:prop>"
sProps = sProps & "</d:propfind>"

foo.Open "PROPFIND", "http://HOFFA/Exchange/Corky/Inbox/", False, _
                     "Exchange\Corky", "password"
foo.setRequestHeader "Content-type:", "text/xml"
foo.setRequestHeader "Depth", "1,noroot"
foo.send (sProps)
sXML = foo.responseText
Figure 12 Creating ArticleItems for the Sample
strURL = "http://hoffa/public/Articles" & GetGUID & ".eml"

' Set some properties
sProps = "<?xml version='1.0'?>"
sProps = sProps & "<d:propertyupdate " & _
         "xmlns:b='urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/' " & _
         "xmlns:e='urn:schemas:httpmail:' " & _
         "xmlns:a='urn:schemas:mailheader:' " & _
         "xmlns:g='http://ecollege.com/' xmlns:c='xml:' " & _
         "xmlns:i='http://schemas.microsoft.com/mapi/proptag/' " & _
         "xmlns:f='http://schemas.microsoft.com/exchange/' " & _
         "xmlns:h='urn:schemas-microsoft-com:office:office' " & _
         "xmlns:j='http://schemas.microsoft.com/repl/' " & _
         "xmlns:k='urn:schemas-microsoft-com:exch-data:' xmlns:d='DAV:'>" 

sProps = sProps & "<d:set>"
sProps = sProps & "<d:prop>"
sProps = sProps & "<e:textdescription>" & articletxt.Text _
                & "</e:textdescription>"
sProps = sProps & "<d:contentclass>" & CUSTOMSCHEMA _
                & "content-classes:articleitem</d:contentclass>"
sProps = sProps & "<e:subject>" & titletxt.Text & "</e:subject>"
sProps = sProps & "<e:fromname>" & authornametxt.Text & "</e:fromname>"
sProps = sProps & "<g:articledifficulty b:dt='int'>" _
                & difficultycbo.Text & "</g:articledifficulty>"

sProps = sProps & "<g:articlesummary>" & summarytxt.Text _
                & "</g:articlesummary>"
sProps = sProps & "<g:articlekeywords>" & keywordstxt.Text _
                & "</g:articlekeywords>"
sProps = sProps & "<g:articlecodeurl>" & codeurltxt.Text _
                & "</g:articlecodeurl>"
sProps = sProps & "</d:prop>"
sProps = sProps & "</d:set>"
sProps = sProps & "</d:propertyupdate>"

foo.Open "PROPPATCH", strURL, False, "Exchange\Corky", "password"
foo.setRequestHeader "Content-type:", "text/xml"
foo.send sProps

MsgBox "Done!"
Page view tracker