using VSTO to get Available Mailboxes

Status
Not open for further replies.
O

OutlookNewBie11

Using VSTO and C# anyone know how to get a listing of available

mailboxes a user has on his default profile? I would imagine this to be

simple..

OutlookNewBie11
 
Outlook version?

"OutlookNewBie11" <OutlookNewBie11.4a3fd3e@outlookbanter.com> wrote in

message news:OutlookNewBie11.4a3fd3e@outlookbanter.com...

> Using VSTO and C# anyone know how to get a listing of available
> mailboxes a user has on his default profile? I would imagine this to be
> simple..

> > OutlookNewBie11
 
Outlook 2007..

I can get a list of 'folders" and filter them.. find ones with "Mailbox

-" ……..But.. is that the proper way?

Any other way?

Eventually I will need to send mail from any of the accounts a user has

access to.

So if Joe smith is the primary exchange account (Remember you can only

have 1 exchange account) and he has access to Billy Bobs email account

how can I programmatically know this? And then, if I type a new email

and click send I want to override the send button(Which I know how to

do) and ask which email account to send from.. But.. since there is

only ONE account setup this might be tricky..

Any help at all is appreciated.

' - [MVP - Outlook Wrote:
> ;314784']Outlook version?

> >

>

> "OutlookNewBie11" OutlookNewBie11.4a3fd3e@outlookbanter.com wrote in
> message news:OutlookNewBie11.4a3fd3e@outlookbanter.com...-

> Using VSTO and C# anyone know how to get a listing of available
> mailboxes a user has on his default profile? I would imagine this to
> be
> simple..

> > OutlookNewBie11 -


OutlookNewBie11
 
Use the Outlook 2007 Stores collection for that. It returns all opened

stores. The help on that method in the VBA Object Browser has examples of

how to get the default store and how to tell what mailboxes are primary and

secondary mailboxes.

NameSpace.Stores is all the loaded stores, NameSpace.DefaultStore is the

default one. Store.ExchangeStoreType returns olExchangeMailbox,

olExchangePublicFolder, olNotExchange and olPrimaryExchangeMailbox. That

should be exactly what you want.

You can set SendUsingAccount on a MailItem, but if there's only 1 account

(Exchange) that does you no good. So set the SendOnBehalfName property for

sending as another mailbox. For example, if I want to send something as my

sales mailbox I just use that in that property, and as I have SendAs

permissions for that mailbox it goes out from sales. Without SendAs

permissions you get a Sent on Behalf Of header instead of a change of From

address.

"OutlookNewBie11" <OutlookNewBie11.4a54ebd@outlookbanter.com> wrote in

message news:OutlookNewBie11.4a54ebd@outlookbanter.com...

> Outlook 2007..
> I can get a list of 'folders" and filter them.. find ones with "Mailbox
> -" ....But.. is that the proper way?
> Any other way?
> Eventually I will need to send mail from any of the accounts a user has
> access to.

> So if Joe smith is the primary exchange account (Remember you can only
> have 1 exchange account) and he has access to Billy Bobs email account
> how can I programmatically know this? And then, if I type a new email
> and click send I want to override the send button(Which I know how to
> do) and ask which email account to send from.. But.. since there is
> only ONE account setup this might be tricky..

> Any help at all is appreciated.
 
" - " wrote:


> Use the Outlook 2007 Stores collection for that. It returns all opened
> stores. The help on that method in the VBA Object Browser has examples of
> how to get the default store and how to tell what mailboxes are primary and
> secondary mailboxes.

> NameSpace.Stores is all the loaded stores, NameSpace.DefaultStore is the
> default one. Store.ExchangeStoreType returns olExchangeMailbox,
> olExchangePublicFolder, olNotExchange and olPrimaryExchangeMailbox. That
> should be exactly what you want.

> You can set SendUsingAccount on a MailItem, but if there's only 1 account
> (Exchange) that does you no good. So set the SendOnBehalfName property for
> sending as another mailbox. For example, if I want to send something as my
> sales mailbox I just use that in that property, and as I have SendAs
> permissions for that mailbox it goes out from sales. Without SendAs
> permissions you get a Sent on Behalf Of header instead of a change of From
> address.

> >

>

> "OutlookNewBie11" <OutlookNewBie11.4a54ebd@outlookbanter.com> wrote in
> message news:OutlookNewBie11.4a54ebd@outlookbanter.com...
> > Outlook 2007..
> > I can get a list of 'folders" and filter them.. find ones with "Mailbox
> > -" ....But.. is that the proper way?
> > Any other way?
> > Eventually I will need to send mail from any of the accounts a user has
> > access to.
> > So if Joe smith is the primary exchange account (Remember you can only
> > have 1 exchange account) and he has access to Billy Bobs email account
> > how can I programmatically know this? And then, if I type a new email
> > and click send I want to override the send button(Which I know how to
> > do) and ask which email account to send from.. But.. since there is
> > only ONE account setup this might be tricky..
> > Any help at all is appreciated.


>
 
Hi Ken,

Can I get access to the task folders created in an exchange account in

outlook 2003 using the stores collection method? (This exhange one is

different from the default account). I'm getting only methods to add and

remove stores, so how could i do this for outlook 2003 using vsto? Any

guidence would be appreciated.

Thanks.

Ashok
wrote:


> Use the Outlook 2007 Stores collection for that. It returns all opened
> stores. The help on that method in the VBA Object Browser has examples of
> how to get the default store and how to tell what mailboxes are primary and
> secondary mailboxes.

> NameSpace.Stores is all the loaded stores, NameSpace.DefaultStore is the
> default one. Store.ExchangeStoreType returns olExchangeMailbox,
> olExchangePublicFolder, olNotExchange and olPrimaryExchangeMailbox. That
> should be exactly what you want.

> You can set SendUsingAccount on a MailItem, but if there's only 1 account
> (Exchange) that does you no good. So set the SendOnBehalfName property for
> sending as another mailbox. For example, if I want to send something as my
> sales mailbox I just use that in that property, and as I have SendAs
> permissions for that mailbox it goes out from sales. Without SendAs
> permissions you get a Sent on Behalf Of header instead of a change of From
> address.

> >

>

> "OutlookNewBie11" <OutlookNewBie11.4a54ebd@outlookbanter.com> wrote in
> message news:OutlookNewBie11.4a54ebd@outlookbanter.com...
> > Outlook 2007..
> > I can get a list of 'folders" and filter them.. find ones with "Mailbox
> > -" ....But.. is that the proper way?
> > Any other way?
> > Eventually I will need to send mail from any of the accounts a user has
> > access to.
> > So if Joe smith is the primary exchange account (Remember you can only
> > have 1 exchange account) and he has access to Billy Bobs email account
> > how can I programmatically know this? And then, if I type a new email
> > and click send I want to override the send button(Which I know how to
> > do) and ask which email account to send from.. But.. since there is
> > only ONE account setup this might be tricky..
> > Any help at all is appreciated.


>
 
Ken,

My main intention is to access that exchange mailbox (.pst account) and then

get access to the task folder list and then perform some action. How can I do

this ? I tried to check in the vba object browser and didnot get one to acess

this. If I'm not wrong then I have a query does outlook 2003 library exposes

any member method to acess any exchange acocunt in a mail box and then get

access to items in that like task folder or contacts...etc? Please guide me.

Cheers

Ashok

"Ashok" wrote:


> Hi Ken,

> Can I get access to the task folders created in an exchange account in
> outlook 2003 using the stores collection method? (This exhange one is
> different from the default account). I'm getting only methods to add and
> remove stores, so how could i do this for outlook 2003 using vsto? Any
> guidence would be appreciated.
> Thanks.
> Ashok

> " - " wrote:
>
> > Use the Outlook 2007 Stores collection for that. It returns all opened
> > stores. The help on that method in the VBA Object Browser has examples of
> > how to get the default store and how to tell what mailboxes are primary and
> > secondary mailboxes.
> > NameSpace.Stores is all the loaded stores, NameSpace.DefaultStore is the
> > default one. Store.ExchangeStoreType returns olExchangeMailbox,
> > olExchangePublicFolder, olNotExchange and olPrimaryExchangeMailbox. That
> > should be exactly what you want.
> > You can set SendUsingAccount on a MailItem, but if there's only 1 account
> > (Exchange) that does you no good. So set the SendOnBehalfName property for
> > sending as another mailbox. For example, if I want to send something as my
> > sales mailbox I just use that in that property, and as I have SendAs
> > permissions for that mailbox it goes out from sales. Without SendAs
> > permissions you get a Sent on Behalf Of header instead of a change of From
> > address.
> > > >

> >

> > "OutlookNewBie11" <OutlookNewBie11.4a54ebd@outlookbanter.com> wrote in
> > message news:OutlookNewBie11.4a54ebd@outlookbanter.com...
> > > > Outlook 2007..
> > > I can get a list of 'folders" and filter them.. find ones with "Mailbox
> > > -" ....But.. is that the proper way?
> > > Any other way?
> > > Eventually I will need to send mail from any of the accounts a user has
> > > access to.
> > > > So if Joe smith is the primary exchange account (Remember you can only
> > > have 1 exchange account) and he has access to Billy Bobs email account
> > > how can I programmatically know this? And then, if I type a new email
> > > and click send I want to override the send button(Which I know how to
> > > do) and ask which email account to send from.. But.. since there is
> > > only ONE account setup this might be tricky..
> > > > Any help at all is appreciated.

> >
 
For an Exchange mailbox you must have permissions on that mailbox and it

should be opened as part of the Outlook profile if you want to access it

using the Stores collection. The mailbox is then loaded automatically when

you start Outlook.

For only a specific default folder in a mailbox in which you have

permissions you use the NameSpace.GetSharedDefaultFolder() method to get

access to that folder as a MAPIFolder (Folder for Outlook 2007). In that

case the Stores collection doesn't enter into it. AddStore() and

RemoveStore() are only for PST files.

"Ashok" <Ashok> wrote in message

news:FD07752D-1877-4B59-964F-6B3A6320199F@microsoft.com...
> Hi Ken,

> Can I get access to the task folders created in an exchange account in
> outlook 2003 using the stores collection method? (This exhange one is
> different from the default account). I'm getting only methods to add and
> remove stores, so how could i do this for outlook 2003 using vsto? Any
> guidence would be appreciated.
> Thanks.
> Ashok
 
See my other answer in this thread.

However, something you say here makes no sense. There is no such thing as an

Exchange mailbox that's a PST file. PST files are local storage and Exchange

mailboxes are stored on the server. They are not the same thing at all.

"Ashok" <Ashok> wrote in message

news:8BA6BF64-2363-4168-AB0F-7BFC15D71C3A@microsoft.com...
> Ken,

> My main intention is to access that exchange mailbox (.pst account) and
> then
> get access to the task folder list and then perform some action. How can I
> do
> this ? I tried to check in the vba object browser and didnot get one to
> acess
> this. If I'm not wrong then I have a query does outlook 2003 library
> exposes
> any member method to acess any exchange acocunt in a mail box and then get
> access to items in that like task folder or contacts...etc? Please guide
> me.
> Cheers
> Ashok
 
Hi Ken,

Thank you very much for your very prompt response, help and clarification

and sorry for my side delay. Actually my client has multiple mailbox setup in

outllok 2003 running on vista os. And I have to do some task managment

operation with the outlook task folders of 2/3 mail boxes what he has. I'm

using vsto for outlook 2003 dot net application. The access and control of

the default mailbox in client's outlook2003 I've done. But I'm not getting

how to get access to other mailboxes? Can you guide me in this what lib I can

use?

My understanding at this point of time is: The Stores collection of the

outlook namespace object gives me access to other mailboxes. and once I get

access to the 2nd /3rd mailbox then I can get access to the task folders in

that mail box. When I saw the outlook 2003 library does not have any methods

like Stores but Outlook 2007 library has it. so my confusion here is how to

get access to other mailboxes? I would greatly appreciate your help in this

regard.

Cheers

Ashok
wrote:


> For an Exchange mailbox you must have permissions on that mailbox and it
> should be opened as part of the Outlook profile if you want to access it
> using the Stores collection. The mailbox is then loaded automatically when
> you start Outlook.

> For only a specific default folder in a mailbox in which you have
> permissions you use the NameSpace.GetSharedDefaultFolder() method to get
> access to that folder as a MAPIFolder (Folder for Outlook 2007). In that
> case the Stores collection doesn't enter into it. AddStore() and
> RemoveStore() are only for PST files.

> >

>

> "Ashok" <Ashok> wrote in message
> news:FD07752D-1877-4B59-964F-6B3A6320199F@microsoft.com...
> > Hi Ken,
> > Can I get access to the task folders created in an exchange account in
> > outlook 2003 using the stores collection method? (This exhange one is
> > different from the default account). I'm getting only methods to add and
> > remove stores, so how could i do this for outlook 2003 using vsto? Any
> > guidence would be appreciated.
> > Thanks.
> > Ashok


>
 
In Outlook 2003 the NameSpace.Folders collection has all the loaded stores.

So you can iterate that to get at each of the already loaded delegate

mailboxes.

"Ashok" <Ashok> wrote in message

news:92C9485C-F0DE-4C83-BFE3-DC5DBA4CFC25@microsoft.com...
> Hi Ken,

> Thank you very much for your very prompt response, help and clarification
> and sorry for my side delay. Actually my client has multiple mailbox setup
> in
> outllok 2003 running on vista os. And I have to do some task managment
> operation with the outlook task folders of 2/3 mail boxes what he has. I'm
> using vsto for outlook 2003 dot net application. The access and control of
> the default mailbox in client's outlook2003 I've done. But I'm not getting
> how to get access to other mailboxes? Can you guide me in this what lib I
> can
> use?

> My understanding at this point of time is: The Stores collection of the
> outlook namespace object gives me access to other mailboxes. and once I
> get
> access to the 2nd /3rd mailbox then I can get access to the task folders
> in
> that mail box. When I saw the outlook 2003 library does not have any
> methods
> like Stores but Outlook 2007 library has it. so my confusion here is how
> to
> get access to other mailboxes? I would greatly appreciate your help in
> this
> regard.

> Cheers
> Ashok
 
Thank you very much for your prompt guidence. I'm going to play with this.

I'll let you know the result. Thanks again for your help.

Cheers

Ashok
wrote:


> In Outlook 2003 the NameSpace.Folders collection has all the loaded stores.
> So you can iterate that to get at each of the already loaded delegate
> mailboxes.

> >

>

> "Ashok" <Ashok> wrote in message
> news:92C9485C-F0DE-4C83-BFE3-DC5DBA4CFC25@microsoft.com...
> > Hi Ken,
> > Thank you very much for your very prompt response, help and clarification
> > and sorry for my side delay. Actually my client has multiple mailbox setup
> > in
> > outllok 2003 running on vista os. And I have to do some task managment
> > operation with the outlook task folders of 2/3 mail boxes what he has. I'm
> > using vsto for outlook 2003 dot net application. The access and control of
> > the default mailbox in client's outlook2003 I've done. But I'm not getting
> > how to get access to other mailboxes? Can you guide me in this what lib I
> > can
> > use?
> > My understanding at this point of time is: The Stores collection of the
> > outlook namespace object gives me access to other mailboxes. and once I
> > get
> > access to the 2nd /3rd mailbox then I can get access to the task folders
> > in
> > that mail box. When I saw the outlook 2003 library does not have any
> > methods
> > like Stores but Outlook 2007 library has it. so my confusion here is how
> > to
> > get access to other mailboxes? I would greatly appreciate your help in
> > this
> > regard.
> > Cheers
> > Ashok


>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Develop for OL2003 on OL2007 machine using VS2008 and VSTO? Outlook VBA and Custom Forms 1
X Highlight block of text in an outlook mail using c#2008 vsto Outlook VBA and Custom Forms 1
H using VBA to edit subject line Outlook VBA and Custom Forms 0
e_a_g_l_e_p_i Need clarification on 2-Step Verification for Gmail using Outlook 2021 Using Outlook 10
e_a_g_l_e_p_i Outlook 2021 not letting me setup my Gmail using pop Using Outlook 1
Geldner Problem submitting SPAM using Outlook VBA Form Outlook VBA and Custom Forms 2
O How to find out the domain and server settings that my Outlook is using? Using Outlook 2
S Outlook 2019 Custom outlook Add-in using Visual Studio Outlook VBA and Custom Forms 0
D Outlook 2021 Using vba code to delete all my spamfolders not only the default one. Outlook VBA and Custom Forms 0
M using excel to sort outlook appointment items Outlook VBA and Custom Forms 4
R Advise on using multiple instances of network files based on customers Outlook VBA and Custom Forms 8
HarvMan Using Emojis in Outlook 365 Using Outlook 3
T Outlook 2019 Not Using Auto Compete After Deletion of 365 Using Outlook 1
M USING INITIALS AS RECIPIENTS Using Outlook 1
T Outlook 2019 Using Gmail aliases in Outlook Using Outlook 6
M Saving emails using Visual Basic - Selecting folder with msoFileDialogFolderPicker Outlook VBA and Custom Forms 6
Z Import Tasks from Access Using VBA including User Defined Fields Outlook VBA and Custom Forms 0
justicefriends How to set a flag to follow up using VBA - for addressee in TO field Outlook VBA and Custom Forms 11
M Extract "Date sent" from emails (saved to folder using drag and drop) Outlook VBA and Custom Forms 1
I Outlook for Mac 2019 using on desktop and laptop IMAP on both need help with folders Using Outlook 1
David McKay VBA to manually forward using odd options Outlook VBA and Custom Forms 1
H Stationery using between OL 2019 and OL 2010 Using Outlook 0
P Prevent Outlook 2016 from using DASL filter Using Outlook 4
O Calendar - Location: what happens when using my own way of entering locations Using Outlook 1
M Disable Contact Card Results when using "Search People" in Outlook Ribbon Using Outlook 7
K can't get custom form to update multiple contacts using VBA Outlook VBA and Custom Forms 3
S Outlook VBA How to adapt this code for using in a different Mail Inbox Outlook VBA and Custom Forms 0
pcunite Outlook 2019/O365 Build 13127.20408 errors when using MAPI calls Using Outlook 1
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
M Outlook 2013 reminder email by using Outlook vba Outlook VBA and Custom Forms 2
X Using Outlook 2013 and Outlook 365 Using Outlook 1
A Going to folder using shortcuts Using Outlook 3
A Outlook replies not using "delivered to" address in From Using Outlook 1
Terry Sullivan E-Mails Sent Using a Group Box Result in 70 Kickbacks Using Outlook 4
O Email not leaving Outbox when using Excel VBA to sync Outlook account Outlook VBA and Custom Forms 4
K Using Outlook 2016 to draw Using Outlook 1
O Outlook 365 - suddenly unable to send using Gmail POP3 Using Outlook 10
N Disable Auto Read Receipts sent after using Advanced Find Using Outlook 4
G Outlook 2016 sync contacts directly between phone and computer using outlook 2016 Using Outlook 0
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
O Save attachments using hotkey without changing attributes Outlook VBA and Custom Forms 1
J Add an Attachment Using an Array and Match first 17 Letters to Matching Template .oft to Send eMail Outlook VBA and Custom Forms 2
A Edit subject - and change conversationTopic - using VBA and redemption Outlook VBA and Custom Forms 2
A Using or not using apostrophes in search terms has this changed? Using Outlook 0
O Office 365 using POP3 on both laptop and desktop Using Outlook 0
M Using field names to capture a data element Using Outlook 0
B Vba to monitor time to respond to emails using a shared mailbox Outlook VBA and Custom Forms 5
B Looking to get the Recipient email address (or even the "friendly name") from an email I am replying to using VBA Outlook VBA and Custom Forms 4
D Using a VBA Custom Form to Send Reoccurring Email Upon Task Completion Outlook VBA and Custom Forms 4
Z Adding dropdown list using custom form Outlook VBA and Custom Forms 7

Similar threads

Back
Top