A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Getting an Outlook folder using a path



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 25th 06, 08:52 PM posted to microsoft.public.outlook.program_vba
Paddy
external usenet poster
 
Posts: 5
Default Getting an Outlook folder using a path

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.

Ads
  #2  
Old May 25th 06, 09:03 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Getting an Outlook folder using a path

Answered in another group.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Paddy" wrote in message oups.com...
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.

  #3  
Old May 25th 06, 09:32 PM posted to microsoft.public.outlook.program_vba
Eric Legault [MVP - Outlook]
external usenet poster
 
Posts: 830
Default Getting an Outlook folder using a path

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.


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting a folder give a path Paddy Outlook and VBA 4 May 25th 06 08:53 PM
path of .pst file Jyoti Agarwal Outlook - General Queries 2 April 25th 06 05:39 PM
New user - Location/Path of my my Outlook data is? Want to Backup DJE Outlook - General Queries 1 March 31st 06 07:52 PM
Cheng the path of PST file fter installation of Outlook 2003 using MST Lion Outlook - Installation 1 February 1st 06 11:15 PM
Find complete path for Outlook 2003 address book Russell Resweber Outlook - Using Contacts 1 January 14th 06 05:02 PM


All times are GMT +1. The time now is 10:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.