28 December, 2010

Checking all properties of an outlook item

I was trying to figure out that where Outlook is storing the URL of the sharepoint sites that is is syncronizing to and during this investigation I run into the problem of retrieving all properties of a Outlook folder (I was suspecting that it is stored in a property of the folder).

[Edit:] After finishing this post I have found the following article: Get Sharepoint ULR and it has a hint on where is the information I was looking for and it references the OutlookSpy SW which is an easy to use tool for retrieving all propertis of any items in Outlook.

I quickly identified that the properties of a folder can be retrieved using the "PropertyAccessor" object, but unfortunately you can not retrieve all properties but only those you have the name for. So finally I have written a small VB program, that tests all the commonly know property sets for all string values and prints the results:
(unfortunately I did not find anything sharepoint related :-( )


Sub sharepoint()

Dim PropertySets(15) As String
PropertySets(0) = "{00020329-0000-0000-C000-000000000046}"
PropertySets(1) = "{00062008-0000-0000-C000-000000000046}"
PropertySets(2) = "{00062004-0000-0000-C000-000000000046}"
PropertySets(3) = "{00020386-0000-0000-C000-000000000046}"
PropertySets(4) = "{00062002-0000-0000-C000-000000000046}"
PropertySets(5) = "{6ED8DA90-450B-101B-98DA-00AA003F1305}"
PropertySets(6) = "{0006200A-0000-0000-C000-000000000046}"
PropertySets(7) = "{41F28F13-83F4-4114-A584-EEDB5A6B0BFF}"
PropertySets(8) = "{0006200E-0000-0000-C000-000000000046}"
PropertySets(9) = "{00062041-0000-0000-C000-000000000046}"
PropertySets(10) = "{00062003-0000-0000-C000-000000000046}"
PropertySets(11) = "{4442858E-A9E3-4E80-B900-317A210CC15B}"
PropertySets(12) = "{00020328-0000-0000-C000-000000000046}"
PropertySets(13) = "{71035549-0739-4DCB-9163-00F0580DBBDF}"
PropertySets(14) = "{00062040-0000-0000-C000-000000000046}"
Dim Fs As Folders
Dim F As folder
Dim SPF As folder
Set Fs = Application.GetNamespace("MAPI").Folders
Set Fs = Fs("Sharepoint Lists").Folders
'For Each F In Fs
' Debug.Print (F.name)
'Next F
Set SPF = Fs(1)
Dim p As Outlook.PropertyAccessor

Set p = SPF.PropertyAccessor
Dim i As Long
Dim j As Integer
Dim h8, h9 As String


For j = 0 To 14
Debug.Print PropertySets(j)
For i = 0 To 65535
Rem 001f - string 0040 - date 0005 - floating64 0003 - integer 1003 - multiple integer 000b - Boolean 0102 - Binary
h9 = "http://schemas.microsoft.com/mapi/id/" + PropertySets(j) + "/" + LCase(Right("000" + Hex(i), 4)) + "001f"
On Error Resume Next
Debug.Print ":<" + LCase(Right("000" + Hex(i), 4)) + "001f>:" + p.GetProperty(h9)
On Error GoTo 0
Next i
Next j
Debug.Print "Proptag"
For i = 0 To 65535
h9 = "http://schemas.microsoft.com/mapi/proptag/0x" + LCase(Right("000" + Hex(i), 4)) + "001f"
On Error Resume Next
Rem Debug.Print ":>:" + p.GetProperty(h8)
Debug.Print ":<" + LCase(Right("000" + Hex(i), 4)) + "001f>:" + p.GetProperty(h9)
On Error GoTo 0
Next i

Debug.Print "Done"
End Sub

No comments: