Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get properties from a public folder

Status
Not open for further replies.

bertwst

Technical User
Feb 27, 2003
1
NL
How do i get the properties from an Outlook 200 public folder in MS Access 2000?
 
I would suggest you check that out on an Outlook forum, however, here are a couple procedures you can use to determine how to instantiate a folder.

'******************************************************************************
'Custom procedure: GetFolderPath(ByVal objFolder)
'Purpose: Return a string folder path for a MAPIFolder
'Argument: MAPIFolder object
'Usage: MsgBox "The Folder Path is " & GetFolderPath(objFldr)
'Returns: String representing Folder Path
'******************************************************************************

Function GetFolderPath(ByVal objFolder) As String
On Error Resume Next
Dim strFolderPath As String
Dim objChild As MAPIFolder
Dim objParent As MAPIFolder
strFolderPath = "\" & objFolder.Name
Set objChild = objFolder
Do Until Err <> 0
Set objParent = objChild.Parent
If Err <> 0 Then
Exit Do
End If
strFolderPath = &quot;\&quot; & objParent.Name & strFolderPath
Set objChild = objParent
Loop
GetFolderPath = strFolderPath
End Function

'******************************************************************************
'Custom procedure: OpenMAPIFolder(ByVal strPath)
'Purpose: Return a MAPIFolder from Path argument
'Argument: String representation of folder path
'Usage:
'Set objFldr=OpenMAPIFolder(&quot;\Public Folders\All Public Folders&quot;)
'Returns: MAPIFolder object
'******************************************************************************
Function OpenMAPIFolder(ByVal strPath) As MAPIFolder
Dim objFldr As MAPIFolder
Dim strDir As String
Dim strName As String
Dim i As Integer
On Error Resume Next
If Left(strPath, Len(&quot;\&quot;)) = &quot;\&quot; Then
strPath = Mid(strPath, Len(&quot;\&quot;) + 1)
Else
Set objFldr = golApp.ActiveExplorer.CurrentFolder
End If
While strPath <> &quot;&quot;
i = InStr(strPath, &quot;\&quot;)
If i Then
strDir = Left(strPath, i - 1)
strPath = Mid(strPath, i + Len(&quot;\&quot;))
Else
strDir = strPath
strPath = &quot;&quot;
End If
If objFldr Is Nothing Then
Set objFldr = golApp.GetNamespace(&quot;MAPI&quot;).Folders(strDir)
On Error GoTo 0
Else
Set objFldr = objFldr.Folders(strDir)
End If
Wend
Set OpenMAPIFolder = objFldr
End Function



-------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top