开发者

.Net Application to select Profile before opening Outlook

I've created a VB.Net application that starts by creating an Outlook application object. I've since created multiple profiles on my PC but can't see any obvious methods to choose a certain Profile when opening the Outlook application programmatically.

I was expecting this line

Dim oa A开发者_StackOverflow社区s New Microsoft.Office.Interop.Outlook.Application

to become something like

Dim oa As New Microsoft.Office.Interop.Outlook.Application
oa.OpenProfile("My Second Profile")

What can I do to explicitly set which profile to open, or is something wrong with my understanding of the Outlook object model?


Redemption seems to let me choose profiles, based on what I can see in the documentation, and there's an additional product you can get to manage profiles specifically at the site.


The answer is that I have the wrong understanding of the Outlook object model. The following code lets me 'pick' a profile (after already adding a reference and importing Microsoft.Office.Interop.Outlook at the top of my module):

Dim appOutlook As New Application
Dim nmsNamespace As [NameSpace]
nmsNamespace = appOutlook.GetNamespace("MAPI")
nmsNamespace.Logon("TestMailBox3")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜