how to (re)set the default data file for Outlook in a VB program

Status
Not open for further replies.
R

ron podl

I want to be able to (re)set the default data file for Outlook 2007 in a VB

program (using Visual Studio 2008).

I would like to recognize which Store is the "default data file" and switch

the default to different file.

I'm assuming that, as the Outlook dialogs do, you can't remove the default

store until a new default is set.

See rough program outline.

For Each s as Store In outlookNS.Stores

dim NewName as String = appdata & "\" & Path.GetFileName(s.FilePath)

copy the original Store file to a new location (NewName)

outlookNS.AddStore(NewName)

if s.? is default data file then ' how can I find if it is the default?

find the store just added

make it the default data file ' how to set it?

end if

outlookNS.RemoveStore(s.GetRootFolder)

Next
 
K

Ken Slovak - [MVP - Outlook]

I don't know any way to do what you want using the Outlook object model.

Maybe using Extended MAPI and C++ or Delphi, but definitely not with VB and

the Outlook object model. My guess, which Dmitry can confirm, is that you'd

need to work with the IProfAdmin interfaces.

"ron podl" <ronpodl> wrote in message

news:9580D1C3-FEDA-4AE0-B746-E0657A1747F4@microsoft.com...
> I want to be able to (re)set the default data file for Outlook 2007 in a VB
> program (using Visual Studio 2008).
> I would like to recognize which Store is the "default data file" and
> switch
> the default to different file.
> I'm assuming that, as the Outlook dialogs do, you can't remove the default
> store until a new default is set.
> See rough program outline.

> For Each s as Store In outlookNS.Stores
> dim NewName as String = appdata & "\" & Path.GetFileName(s.FilePath)
> copy the original Store file to a new location (NewName)
> outlookNS.AddStore(NewName)
> if s.? is default data file then ' how can I find if it is the default?
> find the store just added
> make it the default data file ' how to set it?
> end if
> outlookNS.RemoveStore(s.GetRootFolder)
> Next
 
R

ron podl

Re: how to (re)set the default data file for Outlook in a VB progr

Thanks.

I did find this, http://msdn.microsoft.com/en-us/library/bb176395.aspx, this

morning, which talks about getting & setting properties not explicity exposed

in the outlook object model. Doesn't seem to be much information about the

available SchemaNames/namespaces for any of the non-item objects:

AddressEntry, AddressList, Attachment, ExchangeDistributionList,

ExchangeUser, Folder, Recipient, and Store.

ron
wrote:


> I don't know any way to do what you want using the Outlook object model.
> Maybe using Extended MAPI and C++ or Delphi, but definitely not with VB and
> the Outlook object model. My guess, which Dmitry can confirm, is that you'd
> need to work with the IProfAdmin interfaces.

> >

>

> "ron podl" <ronpodl> wrote in message
> news:9580D1C3-FEDA-4AE0-B746-E0657A1747F4@microsoft.com...
> >I want to be able to (re)set the default data file for Outlook 2007 in a VB
> > program (using Visual Studio 2008).
> > I would like to recognize which Store is the "default data file" and
> > switch
> > the default to different file.
> > I'm assuming that, as the Outlook dialogs do, you can't remove the default
> > store until a new default is set.
> > See rough program outline.
> > For Each s as Store In outlookNS.Stores
> > dim NewName as String = appdata & "\" & Path.GetFileName(s.FilePath)
> > copy the original Store file to a new location (NewName)
> > outlookNS.AddStore(NewName)
> > if s.? is default data file then ' how can I find if it is the default?
> > find the store just added
> > make it the default data file ' how to set it?
> > end if
> > outlookNS.RemoveStore(s.GetRootFolder)
> > Next


> .
>
 
Status
Not open for further replies.
Top