The following Microsoft Visual Basic sample retrieves the security descriptor for a given item in the "MyFolder" public folder:
...
const strFolderURL = "http://MyServer/public/Myfolder"
Dim con As ADODB.Connection
Dim rec As ADODB.Recordset
Dim strSQLQuery As String
Dim strSD As String
dim strDAVDisplayName as String
If con.State = adStateOpen Then
rec.Close
con.Close
End If
con.Provider = "ExOLEDB.Datasource"
con.ConnectionString = strFolderURL
con.Open strSQLQuery = "select ""DAV:displayname"",""http://schemas.microsoft.com/exchange/security/descriptor"" from """ + strFolderURL + """"
rec.Open strSQLQuery, con
If rec.RecordCount > 0 Then
rec.MoveFirst
strDAVDisplayName = rec.Fields("DAV:displayname")
strSD = rec.Fields("http://schemas.microsoft.com/exchange/security/descriptor")
End If
...
For the RTM version of Exchange 2000 Server, "strSD" contains the Extensible Markup Language (XML)-formatted security descriptor for the first item in the "MyFolder" public folder that matches the preceding query. In Exchange 2000 Server SP1 and later, this functionality does not work; you receive a run-time error "94" with an "Invalid use of Null" message instead of the expected XML-formatted security descriptor.