PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Determine the user mailbox for a specific folder
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Determine the user mailbox for a specific folder
![]() |
Determine the user mailbox for a specific folder |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
Guest
Posts: n/a
|
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" <dch3@discussions.microsoft.com> wrote in message news:1D037154-BFBB-45FF-9A8B-8C528C140F6D@microsoft.com... > 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 |
|
Guest
Posts: n/a
|
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" <dch3@discussions.microsoft.com> wrote in message > news:1D037154-BFBB-45FF-9A8B-8C528C140F6D@microsoft.com... > > 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 |
|
Guest
Posts: n/a
|
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" <dch3@discussions.microsoft.com> wrote in message news:756DCB1E-64BA-4F0D-9FA4-A998C2359BD6@microsoft.com... > 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 | |
| Rate This Thread | |
|
|

Main Page 

