写点什么

Microsoft Office 开发工具 Visual Studio 2015

  • 2016-05-04
  • 本文字数:2811 字

    阅读完需:约 9 分钟

针对 Office 开发工具微软推出了 Visual Studio 2015,支持 Clang 编译器和 LLVM 框架,同时可以为 Android 及未来的 iOS 开发应用。Visual Studio 2015 支持 Java、ANT、SQL LITE 和 WebSocket4web,提供原生的 Git 支持。用户可以在新版中尝试创建新的项目类型,下面将重点介绍一下安装步骤和新功能。

安装步骤如下:

  1. 如果还没安装 Visual Studio 2015,立即点击获取 Visual Studio Community 2015 ,完全免费!
  2. 通过 aka.ms/GetLatestOfficeDevTools 获取最新版本的 Office 开发套件。
  3. 请确保您已安装 Outlook 2016

新功能:支持外接应用是重点

Visual Studio 2015 的新功能有很多,除了能够原生地支持在 ECMAScript 2015 中定义的一部分新的语言结构,让 JavaScript 编辑工具利用 Visual Studio 中自带的任务列表,让 JavaScript 编辑更简单之外,Visual Studio 2015 还支持直接生成 Linux 二进制程序。但是,这里将着重介绍 Office 外接应用的功能。

在 Visual Studio 2015 新版中,开发团队已经在 Office 外接应用中添加一个新的项目类型,叫做Outlook Add-in with Commands。外接应用可以在 Outlook 功能区添加按钮,启动外界程序显示菜单或者执行一个自定义的 JavaScript 函数,为用户提供一个无缝的办公室体验。

VersionOverrides 在清单中声明一个命令,忽略旧版本的 Office,从而确保与用户的兼容性。

现在可以创建一个撰写电子邮件时插入自定义文本的外接程序。当报告有关问题时,客户支持人员通常需要询问更多的细节,给出使用说明如何查找版本,序列号等。它会非常方便—节省大量的时间—在 Outlook 中插入这种常见的文本按钮。开发团队还将逐步通过一个示例来创建一个写电子邮件时插入自定义文档的外接程序。

在 Visual Studio 2015 中,通过文件 > 新项目,选择模板 > Office/SharePoint > Outlook Add-in with Commands创建新 Outlook 外接程序命令项目:

若要查看这些按钮,在解决方案管理器中选择 OutlookAddIn 节点,在属性窗口中将启动操作改为办公室桌面客户端,然后启动 Outlook 2016,并按 F5:

正如你所看到的,通过选择显示所有的属性按钮启动外界程序,当用户阅读信息时(在清单中定义MessageRead)出现在功能区。现在当用户在撰写邮件 (MessageCompose 表面) 时在功能区添加一个菜单按钮。

停止调试,然后在解决方案资源管理器上点击OutlookAddInManifest节点,并打开 XML 文件清单。

在标签结束处,向MessageCompose内添加一个添加菜单按钮的ExtensionPoint标签。

ExtensionPointxsi:type=“MessageComposeCommandSurface”
<OfficeTabid=“TabDefault”>
<Groupid=“msgComposeDemoGroup”>
<Labelresid=“groupLabel” />
Controlxsi:type="Menu"id=“msgComposeMenuButton”
<Labelresid=“menuComposeButtonLabel” />

<Titleresid=“menuComposeSuperTipTitle” />
<Descriptionresid=“menuComposeSuperTipDescription” />


<bt:Imagesize="16"resid=“icon16” />
<bt:Imagesize="32"resid=“icon32” />
<bt:Imagesize="80"resid=“icon80” />


<Itemid=“msgComposeMenuItem1”>
<Labelresid=“menuItem1ComposeLabel” />

<Titleresid=“menuItem1ComposeLabel” />
<Descriptionresid="menuItem1ComposeTip
" />


<bt:Imagesize="16"resid=“icon16” />
<bt:Imagesize="32"resid=“icon32” />
<bt:Imagesize="80"resid=“icon80” />

Actionxsi:type=“ExecuteFunction”
addMsg1ToBody


<Itemid=“msgComposeMenuItem2”>
<Labelresid=“menuItem2ComposeLabel” />

<Titleresid=“menuItem2ComposeLabel” />
<Descriptionresid="menuItem2ComposeTip
" />


<bt:Imagesize="16"resid=“icon16” />
<bt:Imagesize="32"resid=“icon32” />
<bt:Imagesize="80"resid=“icon80” />

Actionxsi:type=“ExecuteFunction”
addMsg2ToBody








在清单末尾的Resources节点处,用下面的代码替换 ShortStrings 和 LongStrings 的节点

bt:ShortStrings
<bt:Stringid="groupLabel"DefaultValue=“My Add-in Group”/>
<bt:Stringid="paneReadButtonLabel"DefaultValue=“Display all properties”/>
<bt:Stringid="paneReadSuperTipTitle"DefaultValue=“Get all properties”/>
<bt:Stringid="menuComposeButtonLabel"DefaultValue=“Insert message”/>
<bt:Stringid="menuComposeSuperTipTitle"DefaultValue=“Choose a message to insert”/>
<bt:Stringid="menuItem1ComposeLabel"DefaultValue=“Insert custom message #1”/>
<bt:Stringid="menuItem2ComposeLabel"DefaultValue=“Insert custom message #2”/>
</bt:ShortStrings>
bt:LongStrings
<bt:Stringid="paneReadSuperTipDescription"DefaultValue=“Opens a pane displaying all available properties. This is an example of a button that opens a task pane.”/>
<bt:Stringid="menuComposeButtonTooltip"DefaultValue=“Inserts your choice of text into body of the message.”/>
<bt:Stringid=“menuComposeSuperTipDescription"DefaultValue=“Inserts your choice of text into body of the message. This is an example of a drop-down menu button.”/>
<bt:Stringid=“menuItem1ComposeTip"DefaultValue=“Inserts custom message #1 into the body of the email.” />
<bt:Stringid=“menuItem2ComposeTip"DefaultValue=“Inserts custom message #2 into the body of the email.” />
</bt:LongStrings>

最后,在 functions/functions.js 的结尾处添加一些自定义的 JavaScript 函数:

// Adds text into the body of the item, then reports the results to the info bar.
function addTextToBody(text, icon, event) {
Office.context.mailbox.item.body.setSelectedDataAsync(text,
{ coercionType: Office.CoercionType.Text },
function (asyncResult) {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
statusUpdate(icon, “\”” + text + “\” inserted successfully.”);
} else {
Office.context.mailbox.item.notificationMessages.addAsync(“addTextError”, {
type: “errorMessage”,
message: “Failed to insert \”” + text + “\”: "
+ asyncResult.error.message
});
}
event.completed();
});
}
function addMsg1ToBody(event) {
addTextToBody(“Custom message #1”, “icon16”, event);
}
function addMsg2ToBody(event) {
addTextToBody(“Custom message #2”, “icon16”, event);
}

现在运行外接程序查看新菜单。因为我们将菜单添加到MessageCompose上,你需要点击 Outlook 2016 左上角的创建新邮件图标创建一封新邮件。

就是这个!您已成功添加外界命令程序。如果想学习更多并深入探究如何将命令添加到 Office Add-in 可以查阅 Overview of add-in commands for mail Create a manifest for add-in commands

2016-05-04 01:312541

评论

发布
暂无评论
发现更多内容

场景题:百万数据插入Redis有哪些实现方案?

王磊

鸿蒙NEXT应用上架与分发步骤详解

威哥爱编程

华为 HarmonyOS Open Harmony HarmonyOS框架 HarmonyOS NEXT

财务规划的成功战略之一:建立数据驱动型决策

智达方通

数据分析 企业管理 财务分析 财务管理 财务规划

如何妥善处理 TCP 代理中连接的关闭

不在线第一只蜗牛

网络协议 网络

【DevOps系列】DevOps工具链选型指南

嘉为蓝鲸

DevOps 工具链

【DevOps系列】CICD流程建设之警惕反模式

嘉为蓝鲸

DevOps CI/CD 反模式

浅谈inBuilder中元数据的灰度更新方案

inBuilder低代码平台

低代码 元数据 低代码中的元数据

lazada 商品详情 API 的获取与应用

科普小能手

API 接口 API 测试 lazada商品评价接口 lazada API接口 lazada API

如何炼就 AI 原住民的“自我修养”丨通义灵码走进北京大学创新课堂

阿里云云效

阿里云 云原生 通义灵码

80%腾讯程序员都在用,腾讯云AI代码助手让编码提效42%

科技热闻

【DevOps系列】CICD流程建设之持续集成实践指南

嘉为蓝鲸

DevOps 持续集成 CI/CD

【DevOps系列】需求的层次结构:业务驱动的协作与产品导向的交付

嘉为蓝鲸

DevOps 需求分析

喜报!博睿数据再获“信创工委会技术活动单位”称号

博睿数据

Apache Seata(incubating) 首个版本重磅发布!

阿里巴巴云原生

Apache 阿里云 云原生

从云原生到 AI 原生,网关的发展趋势和最佳实践

阿里巴巴云原生

阿里云 云原生 网关

【核电科技企业】构建一体化服务器智能运维平台,助力降本增效

嘉为蓝鲸

AIOPS 运维‘ 一体化运维

豆包MarsCode Agent 登顶 SWE-bench Lite 评测集

Trae

AI

附演讲视频|隐语城市行·北京站:行业发展趋势、大模型前沿技术、实践落地案例干货打包

隐语SecretFlow

【DevOps系列】DevOps全过程质量管控

嘉为蓝鲸

DevOps

2024 OPPO开发者大会召开,携手火山引擎加速迈进AI语音交互新时代

新消费日报

「用户故事」 从 Thanos 到 GreptimeDB,我们实现了 Prometheus 高效长期存储

Greptime 格睿科技

数据库 云原生 数据迁移

对象存储防勒索升级:XEOS 国内首家通过 NBU 对象锁认证

XSKY星辰天合

如何炼就 AI 原住民的“自我修养”丨通义灵码走进北京大学创新课堂

阿里巴巴云原生

阿里云 云原生 通义灵码

IoTDB 探索季活动|大疆无人机等你来拿

Apache IoTDB

软件测试学习笔记丨Selenium弹窗操作

测试人

软件测试

Microsoft Office开发工具 Visual Studio 2015_微软_Visual Studio中文博客_InfoQ精选文章