我想用所描述的通过Outlook发送电子邮件这里.只要我已经打开Outlook,它就可以正常工作.因此,例如,如果Outlook被最小化并且我执行我的代码,那么我可以发送电子邮件就好了.但如果Outlook关闭,那么我得到一个例外:
{System.Runtime.InteropServices.COMException (0x80004004): Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
at Microsoft.Office.Interop.Outlook._MailItem.get_Recipients()
at OutlookExample.Form1.btnSendEmail_Click(Object sender, EventArgs e) in C:\Users\abc\Documents\Visual Studio 2008\Projects\OutlookExample\OutlookExample\Form1.cs:line 28}
Run Code Online (Sandbox Code Playgroud)
这是代码:
using Outlook = Microsoft.Office.Interop.Outlook;
...
private void btnSendEmail_Click(object sender, EventArgs e)
{
try
{
Outlook.Application oApp = new Outlook.Application();
Outlook.MailItem oMsg = Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMsg.HTMLBody = "Hello, here is your message!";
oMsg.Subject = "This is a test message";
Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add("rhr@sonlinc.dk");
oRecip.Resolve();
oMsg.Send();
oRecip = null;
oRecips = null;
oMsg = …Run Code Online (Sandbox Code Playgroud) 当用户点击我的应用程序中的某个按钮或链接时,我需要打开一个带有预填充附件的新电子邮件窗口.
我正在尝试创建一个Outlook 2010插件,为功能区添加一个新选项卡.我发现如何通过将OfficeId设置为"TabMail"或内置的东西将我的组添加到现有选项卡,但我不想修改现有选项卡.
我现在已经将OfficeId设置为我自己的东西("TabMyAddin"),但它没有显示在Outlook中.我想知道我是否需要以某种方式告诉Outlook添加它并显示它,或者我将如何继续?
如果重要,RibbonType已更改为Microsoft.Outlook.Explorer.
EWS使用正文中的默认"When"文本创建约会.请看下面的图片:

我想知道是否有可能删除或隐藏此文本.
这是我使用EWS托管API创建约会的代码
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1, TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));
service.Credentials = new WebCredentials("ews_calendar", PASSWORD, "acme");
service.Url = new Uri("https://acme.com/EWS/Exchange.asmx");
Appointment newAppointment = new Appointment(service);
newAppointment.Subject = "Test Subject";
newAppointment.Body = "Test Body";
newAppointment.Start = new DateTime(2012, 07, 19, 17, 00, 0);
newAppointment.End = newAppointment.Start.AddMinutes(30);
newAppointment.RequiredAttendees.Add("first.last@acme.com");
// create new appointment
newAppointment.Save(SendInvitationsMode.SendToAllAndSaveCopy);
Run Code Online (Sandbox Code Playgroud) 我已经成功创建了一个新标签,并将其放在预先存在的标签旁边.然后我意识到我只有一个按钮,因此将它放在Home选项卡上更有意义(现在).虽然没有真正得到它.
我试图遵循指南和走路.我给了我一个XML并将其XML更改为以下内容.
<tabs>
<!--<tab idMso="TabAddIns">-->
<tab idMso="TabHome">
<group id="group1" label="Hazaa!">
<box id="box1" />
</group>
</tab>
</tabs>
Run Code Online (Sandbox Code Playgroud)
当我运行项目时,我没有对UI进行任何更改,所以我猜:
TabHome错误(至少对于Outlook 2010),idMso是错误的(至少对于Outlook 2010)或我该怎么做才能改变色带?(Outlook 2010/VSTO/VS 2010/.NET 4).
我使用以下代码拖放单个文件.
private void FormRegion2_DragEnter_1(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{ e.Effect = DragDropEffects.Copy; }
// or this tells us if it is an Outlook attachment drop
else if (e.Data.GetDataPresent("FileGroupDescriptor"))
{ e.Effect = DragDropEffects.Copy; }
// or none of the above
else
{ e.Effect = DragDropEffects.None; }
}
private void FormRegion2_DragDrop_1(object sender, DragEventArgs e)
{
string[] fileNames = null;
if (e.Data.GetDataPresent(DataFormats.FileDrop, false) == true)
{
fileNames = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string fileName in fileNames)
{
}
}
else if (e.Data.GetDataPresent("FileGroupDescriptor"))
{ …Run Code Online (Sandbox Code Playgroud) 我有问题为Outlook创建HTML签名电子邮件.
签名前我有一个样式标签,并为响应式电子邮件添加媒体宽度.
<style type="text/css">
div, p, a, li, td { -webkit-text-size-adjust:none; }
table {
min-width:650px;
}
@media only screen and (max-device-width: 480px) {
td[class=hidden-phone] {
width: 0px !important;
display: none !important;
overflow: hidden !important;
float: left !important;
}
td[class=description] {
width: 100% !important;
}
td[class=visible-phone] {
display: block !important;
width: auto !important;
height: auto !important;
overflow: visible !important;
float:none !important;
}
table {
min-width: auto !important;
}
}
</style>
<table width="100%" style="font-family:'arial';">
<tr>
<td colspan="4" width="100%" style="height:10px;border-bottom:2px solid #96999e;height:0px;"> </td>
</tr> …Run Code Online (Sandbox Code Playgroud) 我正在使用win32com模块访问Outlook .
我希望得到一个任务并标记邮件--Outlook有很多不同的名称,并查看它们的不同类型的"对象".但是,我想获取任务主题列表以及按下任务/待办事项列表(Outlook 2010)时显示的截止日期.

@utapyngo提出了一个非常有用的C#代码示例 - 但我真的需要一些帮助将它转换为python.
Outlook.NameSpace ns = null;
Outlook.MAPIFolder todoFolder = null;
Outlook.Items todoFolderItems = null;
Outlook.TaskItem task = null;
Outlook.ContactItem contact = null;
Outlook.MailItem email = null;
string todoString = string.Empty;
try
{
ns = OutlookApp.Session;
todoFolder = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderToDo);
todoFolderItems = todoFolder.Items;
for (int i = 1; i <= todoFolderItems.Count; i++)
{
object outlookItem = todoFolderItems[i];
if (outlookItem is Outlook.MailItem)
{
email = outlookItem as Outlook.MailItem;
todoString += String.Format("Email: {0} Due:{1}{2}", …Run Code Online (Sandbox Code Playgroud) 我在Outlook中创建了一个基本的自定义任务窗格.
我想拖动一封电子邮件并将其放入任务窗格.当被删除时,它应该允许我将电子邮件捕获为我猜的对象,允许我用它来做事情,例如保存到sharepoint位置.
那可能吗?如果是这样,任何指针?
我使用的是VS2013 C#.NET 4.0,加载项适用于Outlook 2010/2013.
我为Microsoft Outlook 2010创建了一些规则,特定邮件会转到特定文件夹.这很好,但是当我收到新邮件时,我在系统托盘中没有收到警报.
有没有办法来解决这个问题?
outlook-2010 ×10
c# ×4
outlook ×4
c#-4.0 ×2
.net ×1
html ×1
html-email ×1
python ×1
python-2.7 ×1
ribbon ×1
sharepoint ×1
vsto ×1
windows ×1