Office.CustomXmlPrefixMappings interface

Represents a collection of CustomXmlPart objects.

Remarks

Requirement SetsCustomXmlParts

Support details

A capital Y in the following matrix indicates that this interface is supported in the corresponding Office host application. An empty cell indicates that the Office host application doesn't support this interface.

For more information about Office host application and server requirements, see Requirements for running Office Add-ins.

Supported hosts, by platform

Office for Windows desktop Office Online (in browser) Office for iPad
Word Y Y

Methods

addNamespaceAsync(prefix, ns, options, callback)

Asynchronously adds a prefix to namespace mapping to use when querying an item.

getNamespaceAsync(prefix, options, callback)

Asynchronously gets the namespace mapped to the specified prefix.

getPrefixAsync(ns, options, callback)

Asynchronously gets the prefix for the specified namespace.

Method Details

addNamespaceAsync(prefix, ns, options, callback)

Asynchronously adds a prefix to namespace mapping to use when querying an item.

addNamespaceAsync(prefix: string, ns: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
Parameters
prefix
string

Specifies the prefix to add to the prefix mapping list. Required.

ns
string

Specifies the namespace URI to assign to the newly added prefix. Required.

options
Office.AsyncContextOptions

Provides an option for preserving context data of any type, unchanged, for use in a callback.

callback
(result: AsyncResult<void>) => void

Optional. A function that is invoked when the callback returns, whose only parameter is of type Office.AsyncResult.

Returns
void
Remarks

If no namespace is assigned to the requested prefix, the method returns an empty string ("").

getNamespaceAsync(prefix, options, callback)

Asynchronously gets the namespace mapped to the specified prefix.

getNamespaceAsync(prefix: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<string>) => void): void;
Parameters
prefix
string

TSpecifies the prefix to get the namespace for. Required.

options
Office.AsyncContextOptions

Provides an option for preserving context data of any type, unchanged, for use in a callback.

callback
(result: AsyncResult<string>) => void

Optional. A function that is invoked when the callback returns, whose only parameter is of type Office.AsyncResult. The value property of the result is a string that contains the namespace mapped to the specified prefix.

Returns
void
Remarks

If the prefix already exists in the namespace manager, this method will overwrite the mapping of that prefix except when the prefix is one added or used by the data store internally, in which case it will return an error.

getPrefixAsync(ns, options, callback)

Asynchronously gets the prefix for the specified namespace.

getPrefixAsync(ns: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<string>) => void): void;
Parameters
ns
string

Specifies the namespace to get the prefix for. Required.

options
Office.AsyncContextOptions

Provides an option for preserving context data of any type, unchanged, for use in a callback.

callback
(result: AsyncResult<string>) => void

Optional. A function that is invoked when the callback returns, whose only parameter is of type Office.AsyncResult. The value property of the result is a string that contains the prefix of the specified namespace.

Returns
void
Remarks

If no prefix is assigned to the requested namespace, the method returns an empty string (""). If there are multiple prefixes specified in the namespace manager, the method returns the first prefix that matches the supplied namespace.