PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Program Addins Exchange Mailboxes and Redemptions SafeCurrentUser

Reply

Exchange Mailboxes and Redemptions SafeCurrentUser

 
Thread Tools Rate Thread
Old 30-03-2005, 06:13 AM   #1
dedejavu@hotmail.com
Guest
 
Posts: n/a
Default Exchange Mailboxes and Redemptions SafeCurrentUser


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

  Reply With Quote
Old 30-03-2005, 04:29 PM   #2
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Exchange Mailboxes and Redemptions SafeCurrentUser

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
>


  Reply With Quote
Old 30-03-2005, 05:22 PM   #3
dedejavu@hotmail.com
Guest
 
Posts: n/a
Default Re: Exchange Mailboxes and Redemptions SafeCurrentUser

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

  Reply With Quote
Old 01-04-2005, 12:54 AM   #4
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Exchange Mailboxes and Redemptions SafeCurrentUser

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
>


  Reply With Quote
Old 01-04-2005, 11:10 PM   #5
dedejavu@hotmail.com
Guest
 
Posts: n/a
Default Re: Exchange Mailboxes and Redemptions SafeCurrentUser

Thanks again for your time, I'll take a crack at that.

  Reply With Quote
Old 08-04-2005, 11:37 PM   #6
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: Exchange Mailboxes and Redemptions SafeCurrentUser

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
>



  Reply With Quote
Old 11-04-2005, 07:33 PM   #7
dedejavu@hotmail.com
Guest
 
Posts: n/a
Default Re: Exchange Mailboxes and Redemptions SafeCurrentUser

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

  Reply With Quote
Old 11-04-2005, 07:39 PM   #8
dedejavu@hotmail.com
Guest
 
Posts: n/a
Default Re: Exchange Mailboxes and Redemptions SafeCurrentUser

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

  Reply With Quote
Old 12-04-2005, 02:55 PM   #9
Ken Slovak - [MVP - Outlook]
Guest
 
Posts: n/a
Default Re: Exchange Mailboxes and Redemptions SafeCurrentUser

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
>


  Reply With Quote
Old 12-04-2005, 04:41 PM   #10
dedejavu@hotmail.com
Guest
 
Posts: n/a
Default Re: Exchange Mailboxes and Redemptions SafeCurrentUser

Thanks Ken - I'll keep plodding onward.

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

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