• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 527
  • Last Modified:

how do i use vb.net to choose the mailbox folder instead of using pickfolder

Using the code below, I would like oMailbox to choose the Mailbox folder by default instead of using .pickfolder to bring up the popup box and having to select it from the list. Any ideas?
Dim oPst As String = "\\" & System.Environment.MachineName & "\C$\Users\" & System.Environment.UserName & "\Documents\Outlook\EE Migration Temp Mailbox.pst"
        Dim AppDataPst As String = "\\" & System.Environment.MachineName & "\C$\Users\" & System.Environment.UserName & "AppData\Local\Microsoft\Outlook\EE Migration Temp Mailbox.pst"
        Dim oFolder As Outlook.MAPIFolder = Nothing
        Dim oMailbox As Outlook.MAPIFolder = Nothing
        Dim app As New Outlook.Application()
        Dim ns As Outlook.NameSpace = app.GetNamespace("MAPI")

oFolder = ns.Session.Folders.GetLast
oMailbox = ns.Session.PickFolder

Open in new window

0
nebiaat5
Asked:
nebiaat5
  • 2
1 Solution
 
CodeCruiserCommented:
Do you mean this?

oMailbox = app..GetNamespace("Mapi").GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)


http://www.vbdotnetheaven.com/UploadFile/hirendra_singh/Outlook1109172009030335AM/Outlook11.aspx
0
 
nebiaat5Author Commented:
That is sort of what i want. That only chooses the inbox, I want it to choose the actual Mailbox with all the folders underneath, such as inbox, contact, calendars, etc...

Not sure if it is possible, but if it is not, using the code you provided, is there a way to make it copy the items inside the inbox to a pst file programatically as well?

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now