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

Function to return the full path to an Outlook Folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 14th 07, 02:47 AM posted to microsoft.public.outlook.program_vba
dch3
external usenet poster
 
Posts: 105
Default Function to return the full path to an Outlook Folder

I came up with this function to return the full path to any particular
folder. I can't see any issues with it, however - please feel free to break
it, if it can be. (Yeah so I didn't declare the variables in the example...)

Public Function getFullFolderPath()

Set nms = Outlook.Application.GetNamespace("MAPI")
Set targetFolder = nms.PickFolder

strPath = targetFolder

While targetFolder.Parent "Outlook"
strPath = targetFolder.Parent & "\" & strPath
Set targetFolder = targetFolder.Parent
Wend

Set targetFolder = Nothing
Set nms = Nothing

getFullFolderPath = strPath

End Function
Ads
  #2  
Old November 14th 07, 04:44 AM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Function to return the full path to an Outlook Folder

Why not use the MAPIFolder.FullFolderPath property?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"dch3" wrote in message
...
I came up with this function to return the full path to any particular
folder. I can't see any issues with it, however - please feel free to
break
it, if it can be. (Yeah so I didn't declare the variables in the
example...)

Public Function getFullFolderPath()

Set nms = Outlook.Application.GetNamespace("MAPI")
Set targetFolder = nms.PickFolder

strPath = targetFolder

While targetFolder.Parent "Outlook"
strPath = targetFolder.Parent & "\" & strPath
Set targetFolder = targetFolder.Parent
Wend

Set targetFolder = Nothing
Set nms = Nothing

getFullFolderPath = strPath

End Function



  #3  
Old November 14th 07, 12:06 PM posted to microsoft.public.outlook.program_vba
dch3
external usenet poster
 
Posts: 105
Default Function to return the full path to an Outlook Folder

Probably because I'm not familar with that. Also, isn't it only available in
Outlook 2007? The bigger picture is to get the full folder path after a user
selects any folder.

"Dmitry Streblechenko" wrote:

Why not use the MAPIFolder.FullFolderPath property?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"dch3" wrote in message
...
I came up with this function to return the full path to any particular
folder. I can't see any issues with it, however - please feel free to
break
it, if it can be. (Yeah so I didn't declare the variables in the
example...)

Public Function getFullFolderPath()

Set nms = Outlook.Application.GetNamespace("MAPI")
Set targetFolder = nms.PickFolder

strPath = targetFolder

While targetFolder.Parent "Outlook"
strPath = targetFolder.Parent & "\" & strPath
Set targetFolder = targetFolder.Parent
Wend

Set targetFolder = Nothing
Set nms = Nothing

getFullFolderPath = strPath

End Function




  #4  
Old November 14th 07, 06:49 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Function to return the full path to an Outlook Folder

It is definitely available in Outlook 2003, not sure about 2002.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"dch3" wrote in message
...
Probably because I'm not familar with that. Also, isn't it only available
in
Outlook 2007? The bigger picture is to get the full folder path after a
user
selects any folder.

"Dmitry Streblechenko" wrote:

Why not use the MAPIFolder.FullFolderPath property?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"dch3" wrote in message
...
I came up with this function to return the full path to any particular
folder. I can't see any issues with it, however - please feel free to
break
it, if it can be. (Yeah so I didn't declare the variables in the
example...)

Public Function getFullFolderPath()

Set nms = Outlook.Application.GetNamespace("MAPI")
Set targetFolder = nms.PickFolder

strPath = targetFolder

While targetFolder.Parent "Outlook"
strPath = targetFolder.Parent & "\" & strPath
Set targetFolder = targetFolder.Parent
Wend

Set targetFolder = Nothing
Set nms = Nothing

getFullFolderPath = strPath

End Function






 




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
Full folder path in Outlook 2003 search? Anonymous Chief Outlook - General Queries 2 August 31st 07 10:11 PM
File location or full path Vette Miester Outlook Express 1 March 4th 07 04:50 PM
MailItem Folder Path Fox via OfficeKB.com Outlook and VBA 1 July 7th 06 02:39 PM
Getting an Outlook folder using a path Paddy Outlook and VBA 2 May 25th 06 09:32 PM
Getting a folder give a path Paddy Outlook and VBA 4 May 25th 06 08:53 PM


All times are GMT +1. The time now is 07:20 PM.


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