c# winforms: button to open outlook inbox page (outlook saved in computer)
I intend to open an outlook inbox page (see image) when the button is clicked. I use the code below but nothing happened. Hope to get some help
private void button6_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application(); ;
Microsoft.Office.Interop.Outlook.AppointmentItem appointmentItem = (Microsoft.Office.Interop.Outlook.AppointmentItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
}
outlook
add a comment |
I intend to open an outlook inbox page (see image) when the button is clicked. I use the code below but nothing happened. Hope to get some help
private void button6_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application(); ;
Microsoft.Office.Interop.Outlook.AppointmentItem appointmentItem = (Microsoft.Office.Interop.Outlook.AppointmentItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
}
outlook
add a comment |
I intend to open an outlook inbox page (see image) when the button is clicked. I use the code below but nothing happened. Hope to get some help
private void button6_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application(); ;
Microsoft.Office.Interop.Outlook.AppointmentItem appointmentItem = (Microsoft.Office.Interop.Outlook.AppointmentItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
}
outlook
I intend to open an outlook inbox page (see image) when the button is clicked. I use the code below but nothing happened. Hope to get some help
private void button6_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Outlook.Application outlookApplication = new Microsoft.Office.Interop.Outlook.Application(); ;
Microsoft.Office.Interop.Outlook.AppointmentItem appointmentItem = (Microsoft.Office.Interop.Outlook.AppointmentItem)outlookApplication.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
}
outlook
outlook
asked Nov 22 '18 at 21:03
masyita shariffmasyita shariff
476
476
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
I managed to solve my own question. I didn't state in my original question but outlook app is already downloaded inside my laptop.
private void button6_Click(object sender, EventArgs e)
{
Process.Start("outlook.exe");
}
Thanks to all of yall suggestions
add a comment |
I checked your code without an problem. So you need to track your error message of WindowsForm APP and confirm closed your Outlook. In general, you may getting the error about COM ID issue.
Please refer to the following links:
How to open Outlook new mail window c#
Code:
Outlook.Application oApp = new Outlook.Application ();
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem ( Outlook.OlItemType.olMailItem );
oMailItem.To = address;
// body, bcc etc...
oMailItem.Display ( true );
Debug Error:
new Outlook.Application() thorws error if Outlook app is running
Hi Simon, I've checked the link above and followed the dcomcnfg thingy and I cannot find outlook message attachment, so maybe not a COM problem? Aactually my code above, once I pressed the button, there will be a pop-up at my taskbar stating: Another program is using outlook. To disconnect program and exit outlook, click outlook icon and click exit now. In reality, I did not open and outlook and when I checked control panel, outlook is also not running.
– masyita shariff
Nov 23 '18 at 6:17
Maybe some programs are using your Outlook, I think you need to check it.
– Simon Li
Nov 27 '18 at 7:08
add a comment |
Try something like the following (off the top of my head):
Outlook.Application oApp = new Outlook.Application ();
Outlook.Namespace ns = oApp.GetNamespace("MAPI");
ns.Logon();
Outlook.MAPIFolder inbox = ns.GetDEfaultFolder(olFolderInbox);
if (oApp.Explorers.Count > 0)
{
Outlook.Explorer expl = oApp.Explorers[1];
expl.CurrentFolder = inbox;
}
else
{
inbox.Display();
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437954%2fc-sharp-winforms-button-to-open-outlook-inbox-page-outlook-saved-in-computer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I managed to solve my own question. I didn't state in my original question but outlook app is already downloaded inside my laptop.
private void button6_Click(object sender, EventArgs e)
{
Process.Start("outlook.exe");
}
Thanks to all of yall suggestions
add a comment |
I managed to solve my own question. I didn't state in my original question but outlook app is already downloaded inside my laptop.
private void button6_Click(object sender, EventArgs e)
{
Process.Start("outlook.exe");
}
Thanks to all of yall suggestions
add a comment |
I managed to solve my own question. I didn't state in my original question but outlook app is already downloaded inside my laptop.
private void button6_Click(object sender, EventArgs e)
{
Process.Start("outlook.exe");
}
Thanks to all of yall suggestions
I managed to solve my own question. I didn't state in my original question but outlook app is already downloaded inside my laptop.
private void button6_Click(object sender, EventArgs e)
{
Process.Start("outlook.exe");
}
Thanks to all of yall suggestions
answered Dec 3 '18 at 9:34
masyita shariffmasyita shariff
476
476
add a comment |
add a comment |
I checked your code without an problem. So you need to track your error message of WindowsForm APP and confirm closed your Outlook. In general, you may getting the error about COM ID issue.
Please refer to the following links:
How to open Outlook new mail window c#
Code:
Outlook.Application oApp = new Outlook.Application ();
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem ( Outlook.OlItemType.olMailItem );
oMailItem.To = address;
// body, bcc etc...
oMailItem.Display ( true );
Debug Error:
new Outlook.Application() thorws error if Outlook app is running
Hi Simon, I've checked the link above and followed the dcomcnfg thingy and I cannot find outlook message attachment, so maybe not a COM problem? Aactually my code above, once I pressed the button, there will be a pop-up at my taskbar stating: Another program is using outlook. To disconnect program and exit outlook, click outlook icon and click exit now. In reality, I did not open and outlook and when I checked control panel, outlook is also not running.
– masyita shariff
Nov 23 '18 at 6:17
Maybe some programs are using your Outlook, I think you need to check it.
– Simon Li
Nov 27 '18 at 7:08
add a comment |
I checked your code without an problem. So you need to track your error message of WindowsForm APP and confirm closed your Outlook. In general, you may getting the error about COM ID issue.
Please refer to the following links:
How to open Outlook new mail window c#
Code:
Outlook.Application oApp = new Outlook.Application ();
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem ( Outlook.OlItemType.olMailItem );
oMailItem.To = address;
// body, bcc etc...
oMailItem.Display ( true );
Debug Error:
new Outlook.Application() thorws error if Outlook app is running
Hi Simon, I've checked the link above and followed the dcomcnfg thingy and I cannot find outlook message attachment, so maybe not a COM problem? Aactually my code above, once I pressed the button, there will be a pop-up at my taskbar stating: Another program is using outlook. To disconnect program and exit outlook, click outlook icon and click exit now. In reality, I did not open and outlook and when I checked control panel, outlook is also not running.
– masyita shariff
Nov 23 '18 at 6:17
Maybe some programs are using your Outlook, I think you need to check it.
– Simon Li
Nov 27 '18 at 7:08
add a comment |
I checked your code without an problem. So you need to track your error message of WindowsForm APP and confirm closed your Outlook. In general, you may getting the error about COM ID issue.
Please refer to the following links:
How to open Outlook new mail window c#
Code:
Outlook.Application oApp = new Outlook.Application ();
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem ( Outlook.OlItemType.olMailItem );
oMailItem.To = address;
// body, bcc etc...
oMailItem.Display ( true );
Debug Error:
new Outlook.Application() thorws error if Outlook app is running
I checked your code without an problem. So you need to track your error message of WindowsForm APP and confirm closed your Outlook. In general, you may getting the error about COM ID issue.
Please refer to the following links:
How to open Outlook new mail window c#
Code:
Outlook.Application oApp = new Outlook.Application ();
Outlook._MailItem oMailItem = (Outlook._MailItem)oApp.CreateItem ( Outlook.OlItemType.olMailItem );
oMailItem.To = address;
// body, bcc etc...
oMailItem.Display ( true );
Debug Error:
new Outlook.Application() thorws error if Outlook app is running
answered Nov 23 '18 at 1:46
Simon LiSimon Li
23014
23014
Hi Simon, I've checked the link above and followed the dcomcnfg thingy and I cannot find outlook message attachment, so maybe not a COM problem? Aactually my code above, once I pressed the button, there will be a pop-up at my taskbar stating: Another program is using outlook. To disconnect program and exit outlook, click outlook icon and click exit now. In reality, I did not open and outlook and when I checked control panel, outlook is also not running.
– masyita shariff
Nov 23 '18 at 6:17
Maybe some programs are using your Outlook, I think you need to check it.
– Simon Li
Nov 27 '18 at 7:08
add a comment |
Hi Simon, I've checked the link above and followed the dcomcnfg thingy and I cannot find outlook message attachment, so maybe not a COM problem? Aactually my code above, once I pressed the button, there will be a pop-up at my taskbar stating: Another program is using outlook. To disconnect program and exit outlook, click outlook icon and click exit now. In reality, I did not open and outlook and when I checked control panel, outlook is also not running.
– masyita shariff
Nov 23 '18 at 6:17
Maybe some programs are using your Outlook, I think you need to check it.
– Simon Li
Nov 27 '18 at 7:08
Hi Simon, I've checked the link above and followed the dcomcnfg thingy and I cannot find outlook message attachment, so maybe not a COM problem? Aactually my code above, once I pressed the button, there will be a pop-up at my taskbar stating: Another program is using outlook. To disconnect program and exit outlook, click outlook icon and click exit now. In reality, I did not open and outlook and when I checked control panel, outlook is also not running.
– masyita shariff
Nov 23 '18 at 6:17
Hi Simon, I've checked the link above and followed the dcomcnfg thingy and I cannot find outlook message attachment, so maybe not a COM problem? Aactually my code above, once I pressed the button, there will be a pop-up at my taskbar stating: Another program is using outlook. To disconnect program and exit outlook, click outlook icon and click exit now. In reality, I did not open and outlook and when I checked control panel, outlook is also not running.
– masyita shariff
Nov 23 '18 at 6:17
Maybe some programs are using your Outlook, I think you need to check it.
– Simon Li
Nov 27 '18 at 7:08
Maybe some programs are using your Outlook, I think you need to check it.
– Simon Li
Nov 27 '18 at 7:08
add a comment |
Try something like the following (off the top of my head):
Outlook.Application oApp = new Outlook.Application ();
Outlook.Namespace ns = oApp.GetNamespace("MAPI");
ns.Logon();
Outlook.MAPIFolder inbox = ns.GetDEfaultFolder(olFolderInbox);
if (oApp.Explorers.Count > 0)
{
Outlook.Explorer expl = oApp.Explorers[1];
expl.CurrentFolder = inbox;
}
else
{
inbox.Display();
}
add a comment |
Try something like the following (off the top of my head):
Outlook.Application oApp = new Outlook.Application ();
Outlook.Namespace ns = oApp.GetNamespace("MAPI");
ns.Logon();
Outlook.MAPIFolder inbox = ns.GetDEfaultFolder(olFolderInbox);
if (oApp.Explorers.Count > 0)
{
Outlook.Explorer expl = oApp.Explorers[1];
expl.CurrentFolder = inbox;
}
else
{
inbox.Display();
}
add a comment |
Try something like the following (off the top of my head):
Outlook.Application oApp = new Outlook.Application ();
Outlook.Namespace ns = oApp.GetNamespace("MAPI");
ns.Logon();
Outlook.MAPIFolder inbox = ns.GetDEfaultFolder(olFolderInbox);
if (oApp.Explorers.Count > 0)
{
Outlook.Explorer expl = oApp.Explorers[1];
expl.CurrentFolder = inbox;
}
else
{
inbox.Display();
}
Try something like the following (off the top of my head):
Outlook.Application oApp = new Outlook.Application ();
Outlook.Namespace ns = oApp.GetNamespace("MAPI");
ns.Logon();
Outlook.MAPIFolder inbox = ns.GetDEfaultFolder(olFolderInbox);
if (oApp.Explorers.Count > 0)
{
Outlook.Explorer expl = oApp.Explorers[1];
expl.CurrentFolder = inbox;
}
else
{
inbox.Display();
}
answered Nov 23 '18 at 3:06
Dmitry StreblechenkoDmitry Streblechenko
44.1k32860
44.1k32860
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437954%2fc-sharp-winforms-button-to-open-outlook-inbox-page-outlook-saved-in-computer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown