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.
Similar threads
Thread starter Title Forum Replies Date
Diane Poremsky Set Another Data File as Default When Using an Exchange Account Using Outlook 0
reefclaw Outlook 2013 Cannot set outlook.com account as default data file Using Outlook.com accounts in Outlook 3
e_a_g_l_e_p_i Outlook 2010 How to set default email address for website links Using Outlook 3
N How to set automatically the default or user defined Quickstyle Templates by Answer in Outlook Using Outlook 1
A iCloud add-on for Outlook: Reminder for new appointment is set to 'None' by default. How to change? Using Outlook 6
A set onedrive calendar as default in Outlook Using Outlook.com accounts in Outlook 4
Q set as default Using Outlook 5
K Outlook 2013 Multi Accounts set Default different calendar Sender Using Outlook 2
S How to set up domain by default for connections by Outlook Exchange Server Administration 0
M How to set default calendar & contacts Using Outlook 0
B Outlook 2007 - How to set the "send from diff email" as default? Using Outlook 5
B Outlook connector only works when set to default Using Outlook.com accounts in Outlook 5
S How to set Company as default "File As" in Contacts for Outlook 2010 ? Using Outlook 1
G set exch 2010 server as the default hub transport Exchange Server Administration 6
M How to set exchange calendar as default when combining with Internet calendar Using Outlook 2
G how to set contact custom form as default contact form? Using Outlook 7
F Outlook 2010 - Default font color keeps changing frim the one I set. Using Outlook 1
FryW Need help modifying a VBA script for in coming emails to auto set custom reminder time Outlook VBA and Custom Forms 0
O Cannot expand the folder. The set of folders cannot be opened. You do not have permission to log on. Using Outlook 1
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
e_a_g_l_e_p_i Is it possible it set the fonts used to read incoming mail Using Outlook 25
bmtjedi Set objApp = Application Not Working in O365-32bit Using Outlook 1
F how do i set a reminder in onenote 2010 Using Outlook 8
glnz How set up new IMAP on Outlook-Office 365 and merge in pst from Outlook 2003 for same two email accounts? Using Outlook 5
ChrisK2 Send email to advertise@slipstick.com fails: "The group advertising isn't set up to receive messages from..." Using Outlook 3
S How to set up button in ribbon for individual Quick Steps Using Outlook 1
J Set Timer/Countdown on Emails? Outlook VBA and Custom Forms 3
Victor_50 Set all subfolders to not autoarchive Outlook VBA and Custom Forms 11
Z Script to set account? Using Outlook 0
4 Macro to set the category of Deleted Item? Outlook VBA and Custom Forms 2
J What is the best EntryID format to set on MS Access table Outlook VBA and Custom Forms 3
e_a_g_l_e_p_i Can you set reminder to specific times? Using Outlook 7
CWM030 I do not see a way to set the personal archive folder Exchange Server Administration 2
witzker Macro to set contact reminder to next day 9:00 Outlook VBA and Custom Forms 45
O Set columns for all (sub)folders Using Outlook 8
S Appointment-Cannot set Categories because ConversationID is not set Outlook VBA and Custom Forms 1
Fozzie Bear Correct Method to set up Outlook.com accounts as Exchange Using Outlook.com accounts in Outlook 7
e_a_g_l_e_p_i How to set fonts for emails in all folders in Outlook Using Outlook 1
F Set (flagged) reminder for next business day Using Outlook 4
L how to set downloaded cached emails Using Outlook 5
J Object Variable or With Block Not Set Error in Outlook 2016 and not Outlook 2013 Outlook VBA and Custom Forms 3
S set a flag task date as the next weekday Outlook VBA and Custom Forms 4
C Set reminder / appointment by right clicking email Using Outlook 1
R Macro to copy email to excel - Runtime Error 91 Object Variable Not Set Outlook VBA and Custom Forms 11
L set task reminder date to same as start date (without affecting due date) Using Outlook 0
S how to set user properties to a newly created appointment Outlook VBA and Custom Forms 12
C Outlook VBA to set current account Outlook VBA and Custom Forms 1
Diane Poremsky Add Attachments and Set Email Fields During a Mail Merge Using Outlook 0
O How to set subject line in replies using VBA Outlook VBA and Custom Forms 1
A Custom form not showing when recurrence is set for a meeting Using Outlook 0

Similar threads

Top