PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Program Addins
Exchange Mailboxes and Redemptions SafeCurrentUser
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Program Addins
Exchange Mailboxes and Redemptions SafeCurrentUser
![]() |
Exchange Mailboxes and Redemptions SafeCurrentUser |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi Outlook experts,
I am trying to get the current user's exchange folder. I know that a user can view other user's folders so I want to avoid those. I can find the folder I want using objNameSpace.folders.Item("MailBox - " & objNameSpace.CurrentUser) but I get the security prompt from CurrentUser. SafeCurrentUser gives me a different name variation than CurrentUser so I can't use it to find the folder. CurrentUser ='LastName FirstName (EmailID)' SafeCurrentUser.name ='FirstName LastName' I can't just loop through the folders to look for a folder starting with "MailBox" because there might be several. Any suggestions would be so appreciated. Thanks Pachydermitis |
|
|
|
#2 |
|
Guest
Posts: n/a
|
NameSpace.GetDefaultFolder(olFolderInbox).Parent should get you what you
want. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm <dedejavu@hotmail.com> wrote in message news:1112159628.798247.31450@f14g2000cwb.googlegroups.com... > Hi Outlook experts, > I am trying to get the current user's exchange folder. > I know that a user can view other user's folders so I want to avoid > those. I can find the folder I want using > objNameSpace.folders.Item("MailBox - " & objNameSpace.CurrentUser) > but I get the security prompt from CurrentUser. > SafeCurrentUser gives me a different name variation than CurrentUser so > I can't use it to find the folder. CurrentUser ='LastName FirstName > (EmailID)' SafeCurrentUser.name ='FirstName LastName' > I can't just loop through the folders to look for a folder starting > with "MailBox" because there might be several. > Any suggestions would be so appreciated. > Thanks > Pachydermitis > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Thanks for the tip Ken,
Unfortunately my use of GetDefaultFolder often returns a folder from within the user's [Personal Folders] (based on how the user has it set up). Are there other ways to setup the namespace differently or something to ensure I return an exchange folder? Or perhaps is there some other property in my namespace or one of propties redemption makes accessible the I could use instead? Thanks Pachydermitis |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Most of the useful properties like that would be in a folder level above
TopOfStore so you'd need to use CDO 1.21 or Extended MAPI to get at the InfoStore level. However, there are a few things you can do anyway. You could use NameSpace.Folders, which returns the set of top level folders. Iterate that collection and look for "Mailbox" in the MAPIFolder.Name property of each top level folder. You could also use a hack where the store provider is part of the StoreID of a folder. If it's an Exchange store the StoreID string would contain "EMSDB.DLL" and if it's a PST provider it would contain "mspst.dll". Use a case insensitive comparison for that. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm <dedejavu@hotmail.com> wrote in message news:1112199754.238558.104800@f14g2000cwb.googlegroups.com... > Thanks for the tip Ken, > Unfortunately my use of GetDefaultFolder often returns a folder from > within the user's [Personal Folders] (based on how the user has it set > up). Are there other ways to setup the namespace differently or > something to ensure I return an exchange folder? Or perhaps is there > some other property in my namespace or one of propties redemption makes > accessible the I could use instead? > Thanks > Pachydermitis > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Thanks again for your time, I'll take a crack at that.
|
|
|
|
#6 |
|
Guest
Posts: n/a
|
Look at the Namespace.GetSharedDefaultFolder. Note that you can open current
user's mailbox as well as somebody's else mailbox. Also note that the Exchange provider does not like being a secondary store (it looks like a PST store is the default one even though you are using Exchange, right?). Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool <dedejavu@hotmail.com> wrote in message news:1112159628.798247.31450@f14g2000cwb.googlegroups.com... > Hi Outlook experts, > I am trying to get the current user's exchange folder. > I know that a user can view other user's folders so I want to avoid > those. I can find the folder I want using > objNameSpace.folders.Item("MailBox - " & objNameSpace.CurrentUser) > but I get the security prompt from CurrentUser. > SafeCurrentUser gives me a different name variation than CurrentUser so > I can't use it to find the folder. CurrentUser ='LastName FirstName > (EmailID)' SafeCurrentUser.name ='FirstName LastName' > I can't just loop through the folders to look for a folder starting > with "MailBox" because there might be several. > Any suggestions would be so appreciated. > Thanks > Pachydermitis > |
|
|
|
#7 |
|
Guest
Posts: n/a
|
Thanks for looking at this Dmitry,
You are right, PST is the default store and I am using Exchange as well. I'm not exactly sure what you are saying about GetSharedDefaultFold*er. Are you saying that I can use Namespace.GetSharedDefaultFold*er to get a users exchange folder even if a pst is the default store? I messed around with it but was not able to. I can use objNameSpace.folders.Item("Mai*lBox - " & objNameSpace.CurrentUser) to get the exchange folder, but I get the security prompt from CurrentUser. SafeCurrentUser gives me a different name variation than CurrentUser. Thanks again Pachydermitis |
|
|
|
#8 |
|
Guest
Posts: n/a
|
Ken,
Thanks for your help. I have learned a lot from the examples you post in answer to other peoples questions. You method is essentially the method I am using now, except that I have to contend with the possibilty of several exchange folders. A user may have access to another exchange user's folder. Currently I look at each of the 'Mailbox - " folders and then see if the user's name is in the folder name (in any form). It's an ugly hack, and I'm sure there is a better way. Thanks Pachydermitis |
|
|
|
#9 |
|
Guest
Posts: n/a
|
Well, if a PST file is the default store and the Exchange mailbox is a
secondary store that's an ugly situation and really not at all a good practice for many reasons. Unfortunately in that case you can't use the method of getting the default Inbox and its parent folder. In your case I'd probably get the current user name and examine the mailbox string from the top of store folders just as you are. Ugly situations sometimes demand ugly code ![]() -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm <dedejavu@hotmail.com> wrote in message news:1113244776.526297.179000@l41g2000cwc.googlegroups.com... > Ken, > Thanks for your help. I have learned a lot from the examples you post > in answer to other peoples questions. > You method is essentially the method I am using now, except that I have > to contend with the possibilty of several exchange folders. > A user may have access to another exchange user's folder. Currently I > look at each of the 'Mailbox - " folders and then see if the user's > name is in the folder name (in any form). It's an ugly hack, and I'm > sure there is a better way. > Thanks > Pachydermitis > |
|
|
|
#10 |
|
Guest
Posts: n/a
|
Thanks Ken - I'll keep plodding onward.
![]() |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 


