I don't have a C# example, but here's a function that retrieves a MAPIFolder
object by a passed folder path using VB:
'************************************************* *****************************
'Custom procedu OpenMAPIFolder(ByVal strPath)
'Purpose: Return a MAPIFolder from Path argument
'Returns: MAPIFolder object
'************************************************* *****************************
Function OpenMAPIFolder(ByVal strPath) As Outlook.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("\")) = "\" Then
strPath = Mid(strPath, Len("\") + 1)
Else
Set objFldr = m_olApp.ActiveExplorer.CurrentFolder
End If
While strPath ""
i = InStr(strPath, "\")
If i Then
strDir = Left(strPath, i - 1)
strPath = Mid(strPath, i + Len("\"))
Else
strDir = strPath
strPath = ""
End If
If objFldr Is Nothing Then
Set objFldr = m_olApp.GetNamespace("MAPI").Folders(strDir)
On Error GoTo 0
Else
Set objFldr = objFldr.Folders(strDir)
End If
Wend
Set OpenMAPIFolder = objFldr
End Function
--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog:
http://blogs.officezealot.com/legault/
"Paddy" wrote:
Hello,
I am asking the folder path from the user as input in my progam via a
config file. So the user enters something like "\\Mailbox -
User\Inbox\TestMessageFolder". I then take this folder and
analyse/filter the messages in "TestMessageFolder"
I am stuck trying to access the folder via the obvious API in .NET. I
tried
1. GetDefaultFolder - (Obviously) fails because the user entered
folder, "TestMessageFolder", may not be default.
2. GetFolderFromID - Very confusing as the first parameter
entryIDFolder can be passed as a string i.e.
"\\Mailbox\Inbox\TestmessageFolder" but how can I get the second
parameter ,entryIDStore.
I am using C# in Visual Studio .NET 2003 and Outlook 2003
Thanks for any help that you can offer.
- K.