AppDomain 元素AppDomain element

指定除了在SourceLocation 元素中指定的域之外,Office 应信任的其他域。Specifies an additional domain that Office should trust, in addition to the one specified in the SourceLocation element. 指定域具有以下效果:Specifying a domain has these effects:

  • 它允许在桌面 Office 平台上的加载项的根任务窗格中直接打开页面、路由或域中的其他资源。It enables pages, routes, or other resources in the domain to be opened directly in the root task pane of the add-in on desktop Office platforms. (为 web 上的 Office指定不需要的域或在 IFrame 中打开资源,也需要在使用对话框 API打开的对话框中打开资源时。)(Specifying a domain in an AppDomain isn't necessary for Office on the web or to open a resource in an IFrame, nor it is necessary for opening a resource in a dialog opened with the Dialog API.)
  • 它使域中的页面可以从加载项中的 Iframe 进行 Office.js API 调用。It enables pages in the domain to make Office.js API calls from IFrames within the add-in.

加载项类型: 内容、任务窗格和邮件Add-in type: Content, Task pane, Mail

语法Syntax

<AppDomain>string</AppDomain>

重要

  1. AppDomain 元素的值必须包括协议(如 <AppDomain>https://myappdomain.com</AppDomain>)。The value of the AppDomain element must include the protocol (e.g., <AppDomain>https://myappdomain.com</AppDomain>).
  2. 如果有域的显式端口,请将其包括在内(例如, <AppDomain>https://myappdomain.com:9999</AppDomain> )。If there is an explicit port for the domain, include it (e.g.,<AppDomain>https://myappdomain.com:9999</AppDomain>).
  3. 如果需要信任某个子域,请将其包括在内(例如, <AppDomain>https://mysubdomain.myappdomain.com</AppDomain> )。If a subdomain needs to be trusted, include it (e.g.,<AppDomain>https://mysubdomain.myappdomain.com</AppDomain>). 子域 mysubdomain.mydomain.commydomain.com 不同的域。The subdomain mysubdomain.mydomain.com and mydomain.com are different domains. 如果两者都需要信任,则这两个元素都需要位于单独的AppDomain元素中。If both need to be trusted, then both need to be in separate AppDomain elements.
  4. 列出与SourceLocation 元素中指定的域相同的域不起作用,并且可能会引起误导。Listing the same domain as the one specified in the SourceLocation element has no effect and may be misleading. 特别是在上进行开发时 localhost ,不需要为创建AppDomain元素 localhostIn particular, when you are developing on localhost, you don't need to create an AppDomain element for localhost.
  5. 不要将任何段的 URL 包含在域之后。Don't include any segments of a URL past the domain. 例如,不要包含页面的完整 URL。For example, don't include the full URL of a page.
  6. 不要在值上添加一个结束斜杠 "/"。Do not put a closing slash, "/", on the value.

包含于Contained in

AppDomainsAppDomains

注解Remarks

有关详细信息,请参阅 Office 外接程序 XML 清单For more information, see Office Add-ins XML manifest.