|
-
Jul 29th, 2003, 08:59 AM
#1
Thread Starter
Fanatic Member
Open Outlook Folder by Path [Resolved]
how can I open an outlook folder directly from its path.
I need to open a folder that way down in the hiearchy.
when I try the code below, it says it can't find it.
VB Code:
Private Sub CreateFolder()
Dim olfolders As Outlook.Folders
Dim fldr As MAPIFolder
Dim olapp As New Outlook.Application
Dim i As Long
Set olfolders = olapp.GetNamespace("MAPI").Folders
Set fldr = olfolders.Item("Public folders\All Public Folders\Shared private Folders\Outlook Resource Calendars\Equipment\Mass Spectrometers")
Debug.Print fldr.Name
End Sub
Last edited by Dalceon; Jul 29th, 2003 at 09:26 AM.
It Never Fails. Everytime I try to make a program idiot proof, the world makes a better idiot.
-
Jul 29th, 2003, 09:17 AM
#2
Hyperactive Member
Code:
Public Sub SwitchToFolder()
Dim olNS as NameSpace
Set olNS=ThisOutlookSession.GetNameSpace("MAPI")
Set ActiveExplorer.CurrentFolder = olNS.Folders(StoreName).Folders(FolderName)
End Sub
StoreName is the top-level Message Store, as in "Personal Folders".
FolderName is the folder within that store that you want to open.
P.S. To give credit where it is due, I found this on google
-
Jul 29th, 2003, 09:26 AM
#3
Thread Starter
Fanatic Member
Thanks.
I got impatient, and wrote my own function.
VB Code:
Private Function OpenOutlookFolder(FolderPath As String, Folders As Outlook.Folders) As MAPIFolder
Dim tmparray As Variant
Dim fldr As MAPIFolder
Dim i As Integer
tmparray = Split(FolderPath, "\")
Set fldr = Folders.Item(tmparray(0))
For i = 1 To UBound(tmparray)
Set fldr = fldr.Folders.Item(tmparray(i))
Next
Set OpenOutlookFolder = fldr
Set fldr = Nothing
End Function
It Never Fails. Everytime I try to make a program idiot proof, the world makes a better idiot.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|