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

Determine the user mailbox for a specific folder



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old December 3rd 07, 08:49 PM posted to microsoft.public.outlook.program_vba
dch3
external usenet poster
 
Posts: 105
Default Determine the user mailbox for a specific folder

When the .pickfolder method of a namespace object is used to select a folder,
is there a way to determine the mailbox or store in which the folder exists?
For example, if the user has access to multiple mailboxes and selects
'Inbox', I would like to be able to determine whose Inbox was actually
selected.

I'm thinking that the .parent property of the folder won't be an option
since the user could select a subfolder.
  #2  
Old December 3rd 07, 08:54 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Determine the user mailbox for a specific folder

Just keep getting Parent until you've traversed up the hierarchy to Personal
Folders or Mailbox or whatever at the top of the stack.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"dch3" wrote in message
...
When the .pickfolder method of a namespace object is used to select a
folder,
is there a way to determine the mailbox or store in which the folder
exists?
For example, if the user has access to multiple mailboxes and selects
'Inbox', I would like to be able to determine whose Inbox was actually
selected.

I'm thinking that the .parent property of the folder won't be an option
since the user could select a subfolder.


  #3  
Old December 3rd 07, 09:36 PM posted to microsoft.public.outlook.program_vba
dch3
external usenet poster
 
Posts: 105
Default Determine the user mailbox for a specific folder

So I could adapt the function below to get the name then? - Stoping when I
get to 'MAPI' as the parent.

Public Function getFullFolderPath()
'Build the full path to the folder using the .parent property of the
selected folder by moving upward until will get to the topmost level.

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

"Ken Slovak - [MVP - Outlook]" wrote:

Just keep getting Parent until you've traversed up the hierarchy to Personal
Folders or Mailbox or whatever at the top of the stack.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"dch3" wrote in message
...
When the .pickfolder method of a namespace object is used to select a
folder,
is there a way to determine the mailbox or store in which the folder
exists?
For example, if the user has access to multiple mailboxes and selects
'Inbox', I would like to be able to determine whose Inbox was actually
selected.

I'm thinking that the .parent property of the folder won't be an option
since the user could select a subfolder.



  #4  
Old December 3rd 07, 10:14 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Determine the user mailbox for a specific folder

I'd do it more like this:

Do While (Not (targetFolder Is Nothing))
strPath = targetFolder.Parent & "\" & strPath
Set targetFolder = targetFolder.Parent
Loop

The final iteration will be in error, so you might want to clear the Err
object if you intend to do any If testing or use other code that might be
affected by the error state.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"dch3" wrote in message
...
So I could adapt the function below to get the name then? - Stoping when I
get to 'MAPI' as the parent.

Public Function getFullFolderPath()
'Build the full path to the folder using the .parent property of the
selected folder by moving upward until will get to the topmost level.

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
Determine who created an appointment in a public folder Brian Outlook - Calandaring 3 August 27th 07 01:26 PM
Determine if mailbox is a 'resource' or user Tadwick Outlook and VBA 7 August 10th 07 07:02 PM
Determine when folder caching has completed John Nossluap Outlook and VBA 0 October 25th 06 05:41 PM
How can i determine the current date of the calendar folder? [email protected] Outlook - Using Forms 0 September 26th 06 02:20 PM
Determine if a Folder contains a UserProperty Rog Add-ins for Outlook 3 April 10th 06 05:54 PM


All times are GMT +1. The time now is 11:08 AM.


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.