无法获取未定义或空引用的属性“ CategoryColor”

时间:2019-12-03 17:19:41

标签: office-js outlook-web-addins

当尝试将分类设置为邮件时,出现以下错误。

无法获取未定义或空引用的属性“ CategoryColor”

支持需求集1.8,并且“权限”设置为ReadWriteMailbox。

还尝试过手动指定颜色的名称(例如:红色),但是会出现此错误

错误:Sys.ArgumentException:值不在预期范围内。 参数名称:颜色

用于设置类别的方法是

var masterCategoriesToAdd = [
{
    "displayName": "Urgent!",
    "color": Office.MailboxEnums.CategoryColor.Preset0
}
];

Office.context.mailbox.masterCategories.addAsync(masterCategoriesToAdd, function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded) {
    console.log("Successfully added categories to master list");
} else {
    console.log("masterCategories.addAsync call failed with error: " + asyncResult.error.message);
}
});    

是否设置了任何可行的示例?我在网上找不到任何东西。