“通过电子邮件发送文件”来自Acrobat Reader不会调用items.itemadd()事件,以“发送项目”。文件夹?

发布于 2025-01-22 14:48:47 字数 1345 浏览 1 评论 0原文

我有一个带有Outlook的Vsto Addin。我目前在我的items.itemadd()事件中使用“已发送项目”文件夹来拦截电子邮件以处理并将其保存到存放处。如果我创建新电子邮件并从Outlook发送,一切正常,但是如果我在Acrobat Reader中打开一个本地PDF文档,然后单击“通过电子邮件发送文件”工具栏按钮,将Outlook使用为默认值,它会打开新的电子邮件,请填写。电子邮件地址(对我自己),items.itemadd()事件从未被调用?我确实看到电子邮件到达我的“已发送”文件夹中。

有class mailItem处理新电子邮件,并具有event_send,例如

if((m_mailitem是Outlook.mailitem) (((outlook.itemevents_10_event)m_mailitem).send += new Outlook.itemevents_10_sendeventhandler(event_send);

当用户单击新电子邮件上的发送按钮时,event_send()将调用ADDIN类中的sisscribesentfolder()

void event_send() {
addin.subscribesentfolder(m_mailitem)) }

这些方法在Addin类中 私有静态Outlook.mapifolder m_sentflder = null; 私有静态Outlook.items sentitems = null;

public static bool SubscribeSentFolder(object Item) 
{ 
  m_sentFlder=((Outlook.MailItem)Item).SaveSentMessageFolder; 
  if (m_sentFlder != null) 
  { 
    sentitems=m_sentFlder.Items; 
    sentitems.ItemAdd += Items_ItemAdd; 
    return true; 
   } 
 } 

private static void Items_ItemAdd(object item) 
{ 
  object mapiOb=null; 
  if (item is Outlook.MailItem) 
  { 
    mapiOb=((Outlook.MailItem)Item).MAPIOBJECT; 
    if (mapiOb !=null) 
        Process(mapiOb); //Inside this Process method 
                         UnSubscribeSentFolder() will be called.
  } 
}

I have a VSTO addin with Outlook. I currently use the "Sent Items" Folder in my Items.ItemAdd() event to intercept the email to process and save it into a depository. Everything works Ok if I create new email and send from my Outlook, BUT if I open a local PDF document in Acrobat Reader and click on "Send file by email" toolbar button, use Outlook as default, it opens a new email, fill up the email address (to myself), the Items.ItemAdd() event is never called? I do see the email arrives in my "Sent Items" folder.

There is class MailItem which handle new email and has a Event_Send such as

if ((m_MailItem is Outlook.MailItem)
((Outlook.ItemEvents_10_Event)m_MailItem).Send += new
Outlook.ItemEvents_10_SendEventHandler(Event_Send);

When user clicks on Send button on the new email, the event Event_Send() is called which will call SubscribeSentFolder() in Addin class

void Event_Send()
{
AddIn.SubscribeSentFolder(m_MailItem))
}

These methods are in Addin class
private static Outlook.MAPIFolder m_sentFlder=null;
private static Outlook.Items sentitems=null;

public static bool SubscribeSentFolder(object Item) 
{ 
  m_sentFlder=((Outlook.MailItem)Item).SaveSentMessageFolder; 
  if (m_sentFlder != null) 
  { 
    sentitems=m_sentFlder.Items; 
    sentitems.ItemAdd += Items_ItemAdd; 
    return true; 
   } 
 } 

private static void Items_ItemAdd(object item) 
{ 
  object mapiOb=null; 
  if (item is Outlook.MailItem) 
  { 
    mapiOb=((Outlook.MailItem)Item).MAPIOBJECT; 
    if (mapiOb !=null) 
        Process(mapiOb); //Inside this Process method 
                         UnSubscribeSentFolder() will be called.
  } 
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

司马昭之心 2025-01-29 14:48:47

Outlook可能不会等到当您以这种方式发送商品时,您的邮件实际发送了。似乎在关闭Outlook或在下一个启动时将其加载项订阅之前,将邮件项目放在已发送项目文件夹。

一个可能的解决方案是标记放入存储库中的项目(它可以是用户属性或任何其他绰号),并在每个启动时扫描文件夹中的任何未经处理的项目。如果您发现任何过程为他们做这个过程。

对于具有Exchange Server帐户的用户(非接近交换模式或缓存的交换模式),该事件仅对Outlook启动后在服务器上发送的消息触发。该事件将不会在Outlook启动后立即在缓存交换模式下同步的消息,也不会发射该事件,也不会在Outlook以非处方交换模式启动时已经在服务器上的消息。

Outlook may not wait until your mail is sent out actually when you sent items that way. It seems the mail item was put to the Sent Items folder after Outlook was closed or before your add-in subscribes to the event at the next startup.

A possible solution is to mark items put into the repository (it can be a user property or any other moniker) and scan the folder at each start for any unprocessed items. If you find any do the process for them.

For users with an Exchange Server account (non-Cached Exchange Mode or Cached Exchange Mode), the event will fire only for messages that are sent at the server after Outlook has started. The event will not fire for messages that are synchronized in Cached Exchange Mode immediately after Outlook starts, nor for messages that are already on the server when Outlook starts in non-Cached Exchange Mode.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文