站点图标 久久日记本

Office Add-in应用开发小探

Office Add-In应用开发

目录

最近要在 Office365 Store 中上线一个应用,于是就不得不写一个 Office365 Add-in for Outlook 应用了。

参照一下MS的文档,这些引用链接会在后面给出。这里将对 Office Add-in 流程做个讲解。

1.Office Add-in

Office Add-ins are web applications hosted in a web browser control or iframe that run in the context of an Office client application and can interact with a user's documents or mail items.

Office Add-ins 是托管在Web浏览器控件或iframe中的Web应用程序,它们在Office客户端应用程序的上下文中运行,并且可以与用户的文档或邮件项目交互。

也就是说,它是一个网页,一个引用了 Office.js 这个js库的网站^_^

2.开发环境

我在这里使用了VS2017,新建项目:

Visual C# => Office/SharePoint => Add-ins => Outlook Web Add-in

即可。

调试,应用会连接到你的 Office365 开发者账号登录。

假如你的是 Outlook Add-in , 登录成功会自动打开邮箱, 当你选择某封邮件的时候会在旁边出现你开发的应用的标识,点击即可。

3.正式开发

剩下的就是搭建网站开发了,你可以使用.NET 三层架构或者 .NET MVC。

对于 Outlook add-in ,该应用只会在选中某封邮件的时候出现图标。

当应用在 Outlook Online打开,则会打开一个宽度为320px的页面,见上图。

当应用在 Outlook Client Desktop 打开时候,默认依然是320px,然而可以拉伸,最大拉伸长度为半个屏幕。

而利用Office.js 库,就可以用js 和 Outlook 进行交互。

由于这种类型应用目前仅支持 Office2013 和 Office2016 ,浏览器核心基本上是IE9及其以上了,你可以毫不犹豫的选择AngularJS等前端框架开发。

这里不再细致说明,如果你有兴趣,我会在下面列举我参考的一些文档和不错的学习资料以供参考。

在官方网站找到了这些支持的客户端版本:

The following clients support Outlook add-ins.
Client  Supported API requirement sets
Outlook 2016 (Click-to-Run) for Windows 1.1, 1.2, 1.3, 1.4, 1.5
Outlook 2016 (MSI) for Windows  1.1, 1.2, 1.3, 1.4
Outlook 2016 for Mac    1.1, 1.2, 1.3, 1.4, 1.5
Outlook 2013 for Windows    1.1, 1.2, 1.3
Outlook for iPhone  1.4
Outlook for Android 1.4
Outlook on the web (Office 365 and Outlook.com) 1.1, 1.2, 1.3, 1.4, 1.5
Outlook Web App (Exchange 2013 On-Premise)  1.1
Outlook Web App (Exchange 2016 On-Premise)  1.1, 1.2. 1.3
4.参考资料

get email info

了解 适用于 Office 的 JavaScript API

Office.context.mailbox. item

Loading the DOM and runtime environment

探索新的 JavaScript API for Office

最新的microsoft-office开发工具:支持office-add-in-commands和sharepoint-2016开发

如果你想更深入的探索 Office 365开发,不妨阅读一下这本书:

Office 365 开发概览系列文章和教程

这里提供一下备用下载地址 pdf

退出移动版