是否可以使用自定义属性(适用于Office的JavaScript API 1.3)

是否可以使用自定义属性(适用于Office的JavaScript API 1.3),javascript,office-js,office-addins,Javascript,Office Js,Office Addins,我看到了有关的MS Office js api 1.3文档。 但我无法通过office js从word设置中读取任何自定义属性项 `Word.run(function (context) { // Create a proxy object for the document. var thisDocument = context.document; var customProperties = thisDo

我看到了有关的MS Office js api 1.3文档。 但我无法通过office js从word设置中读取任何自定义属性项

       `Word.run(function (context) {

            // Create a proxy object for the document.
            var thisDocument = context.document;

            var customProperties = thisDocument.properties.customProperties;

            context.load(customProperties);

            return context.sync().then(function () {
                var getcount = customProperties.getCount();


                console.log(customProperties.items);
                return context.sync().then(function () {
                    console.log(getcount.value);
                });
            });
        })`
customProperties.items始终返回空数组。在
customProperties
我的自定义属性显示在此()中


MS Office js api还不支持在word中访问自定义属性吗?

CallOfDuty:我认为现在的情况是您没有Office客户端的更新版本(您需要16/0.7766+)。我在最近的一次构建中运行了您的代码,并使用完全相同的代码获得了自定义属性。因此,请确保您正在进行新的更新

顺便说一句,我刚得到你的代码的简化版本。希望这有帮助

函数getProperties(){
运行(函数(上下文){
var customDocProps=context.document.properties.customProperties;
加载(customDocProps);
返回context.sync()
.然后(函数(){
日志(customDocProps.items.length);
})
})

}
CallOfDuty:我认为现在的情况是,您没有Office客户端的更新版本(您需要16/0.7766+)。我在最近的一次构建中运行了您的代码,并使用完全相同的代码获得了自定义属性。因此,请确保您正在进行新的更新

顺便说一句,我刚得到你的代码的简化版本。希望这有帮助

函数getProperties(){
运行(函数(上下文){
var customDocProps=context.document.properties.customProperties;
加载(customDocProps);
返回context.sync()
.然后(函数(){
日志(customDocProps.items.length);
})
})
}