通过调度程序运行 Outlook 的 VBScript 代码 [英] Runing VBScript code for Outlook through a scheduler

查看:54
本文介绍了通过调度程序运行 Outlook 的 VBScript 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为 Outlook 编写了一个 VBScript,可以转发收件箱中超过 30 分钟未读的电子邮件.当我手动运行 vbs 文件时,它工作得很好,但是当我通过 Windows 任务计划程序触发时,它会卡住.似乎它没有命中 Outlook 并在 CreateObject(...) 语句处停止执行.

I have written a VBScript for Outlook that forwards email which are lying unread in the inbox for more than 30 minutes. When I manually run the vbs file it works perfectly fine, but when I trigger is through Windows Task Scheduler it gets stuck. Seems like it does not hit the Outlook and stops executing at the CreateObject(...) statement.

你能告诉我我该怎么做吗?我想安排它每 30 分钟通过 Outlook 运行一次脚本.

Could you please let me know how should I go about. I want to schedule it to run the script over Outlook every 30 min.

推荐答案

当我手动运行 vbs 文件时,它工作得很好,但是当我通过 Windows 任务计划程序触发时,它会卡住.

When I manually run the vbs file it works perfectly fine, but when I trigger is through Windows Task Scheduler it gets stuck.

Microsoft 目前不建议也不支持从任何无人参与的非交互式客户端应用程序或组件(包括 ASP、ASP.NET、DCOM 和 NT 服务)自动化 Microsoft Office 应用程序,因为 Office 可能表现出不稳定在此环境中运行 Office 时的行为和/或死锁.

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

如果您正在构建一个在服务器端上下文中运行的解决方案,您应该尝试使用已经过安全无人值守执行的组件.或者,您应该尝试找到至少允许部分代码在客户端运行的替代方案.如果您使用服务器端解决方案中的 Office 应用程序,该应用程序将缺乏许多成功运行所需的功能.此外,您将面临整体解决方案稳定性的风险.在 中阅读更多相关信息服务器端办公自动化的注意事项文章.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.

如果您只处理 Exchange 配置文件,您可以考虑使用 EWS 作为解决方法,请参阅 Exchange 中的 EWS 托管 API、EWS 和 Web 服务.或适用于 Office 365 用户的 Outlook REST API,请参阅邮件、日历和联系人 REST API 入门.

As a workaround you may consider using EWS if you deal with Exchange profiles only, see EWS Managed API, EWS, and web services in Exchange. Or Outlook REST API which is available for Office 365 users, see Get Started with Mail, Calendar, and Contacts REST APIs.

您也可以考虑使用 Outlook 基于的低级 API - 扩展 MAPI.或者只是围绕该 API 的任何其他第三方包装器,例如 Redemption.

Also you may consider using a low-level API on which Outlook is based on - Extended MAPI. Or just any other third-party wrapper around that API such as Redemption.

这篇关于通过调度程序运行 Outlook 的 VBScript 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆