简体   繁体   English

如何获取Outlook邮件项目的大小?

[英]How to get the Outlook mail item's size?

'm writing an Outlook Add-in for Outlook 2007. This is a VSTO 3.0 , C# add-in. 正在为Outlook 2007编写Outlook加载项。这是VSTO 3.0 C#加载项。 I capture the send event in the add-in and then check some of the Email properties (Which is being sent out) and based on that display some alert. 我在加载项中捕获发送事件,然后检查一些电子邮件属性(正在发送的)以及基于该显示的一些警报。

When I try to get the total size of email using mailItem.Size, it always returns 0 while the actual size of email is not 0. And if I save the email (mailitem.Save()) then mailItem.Size returns the correct size of the mail. 当我尝试使用mailItem.Size获取电子邮件的总大小时,它总是返回0,而电子邮件的实际大小不为0。如果我保存电子邮件(mailitem.Save()),则mailItem.Size返回正确的大小。的邮件。 Does any one know about reason behind this behavior . 有没有人知道这种行为背后的原因。 Is there any otherway to get the email size ? 还有其他方法可以获取电子邮件大小吗?

yes, this is the default behavior in Outlook. 是的,这是Outlook中的默认行为。
I suggest you save it ( MailItem.Save ) before you send it. 我建议你在发送之前保存它( MailItem.Save )。
Saving the email will place it in the drafts folder...but who cares because you will now check its size ( MailItem.Size ) and send it ( MailItem.Send ). 保存电子邮件会将其放在草稿文件夹中...但是谁在乎,因为您现在将检查其大小( MailItem.Size )并发送它( MailItem.Send )。

Does any one know about reason behind this behavior . 有没有人知道这种行为背后的原因。 Is there any otherway to get the email size ? 还有其他方法可以获取电子邮件大小吗?

AFAIK, This is the default behavior in Outlook. AFAIK,这是Outlook中的默认行为。 You cannot get the size till the time you save/send it. 在保存/发送之前,您无法获取大小。

You can however check for the Attachment size or the Body Length if that helps? 但是,如果有帮助,您可以检查附件大小或身体长度?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取Outlook邮件中嵌入图像的真实姓名(CID)? - How to get the real names(CID) of embedded images in an outlook mail item? 如何获取在Outlook 2007上被拖动的邮件项目的信息 - how to get information of a mail Item which is being dragged on Outlook 2007 如何在Outlook中访问撰写邮件项目的主题 - How to access the subject of a compose mail item in Outlook 如何在组合状态下打开Outlook邮件项? - How to open a Outlook mail item in a composing state? 如何检索邮件项的Outlook文件夹(Outlook.MailItem)? - How to retrieve the Outlook folder of a mail item (Outlook.MailItem)? 如何获取与文件夹项关联的发件人电子邮件地址? (vsto / Outlook 2010 / Mapi) - How to get the sender e-mail address associated by the folder item? (vsto / outlook 2010 / mapi) 如何从 Outlook 功能区上下文菜单中获取当前邮件项目 - How do I get the current mail item from Outlook ribbon context menu 带有OFT模板的Outlook邮件项目 - Outlook Mail Item with OFT Template 如何在Outlook邮件项目中添加阻止的文件类型作为附件? - How to add blocked file types as attachments in an outlook mail item? 如何从用户的Outlook邮箱发送邮件 - How to send mail from user's Outlook mailbox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM