Office.SharedProperties interface
表示共享文件夹或共享邮箱中约会或邮件的属性。
有关如何使用此对象的详细信息,请参阅 在 Outlook 外接程序中启用共享文件夹和共享邮箱方案。
注解
[ API set: Mailbox 1.8 for shared folder support, Mailbox 1.13 for shared mailbox support ]
最低权限级别: 读取项
适用的 Outlook 模式:Compose或读取
示例
function performOperation() {
Office.context.mailbox.getCallbackTokenAsync({
isRest: true
},
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded && asyncResult.value !== "") {
Office.context.mailbox.item.getSharedPropertiesAsync({
// Pass auth token along.
asyncContext: asyncResult.value
},
function (asyncResult1) {
let sharedProperties = asyncResult1.value;
let delegatePermissions = sharedProperties.delegatePermissions;
// Determine if user can do the expected operation.
// E.g., do they have Write permission?
if ((delegatePermissions & Office.MailboxEnums.DelegatePermissions.Write) != 0) {
// Construct REST URL for your operation.
// Update <version> placeholder with actual Outlook REST API version e.g. "v2.0".
// Update <operation> placeholder with actual operation.
let rest_url = sharedProperties.targetRestUrl + "/<version>/users/" + sharedProperties.targetMailbox + "/<operation>";
$.ajax({
url: rest_url,
dataType: 'json',
headers:
{
"Authorization": "Bearer " + asyncResult1.asyncContext
}
}
).done(
function (response) {
console.log("success");
}
).fail(
function (error) {
console.log("error message");
}
);
}
}
);
}
}
);
}
属性
delegate |
委托对共享文件夹或用户对共享邮箱拥有的权限。 |
owner | 共享项目所有者的电子邮件地址。 |
target |
供代理人访问的所有者邮箱的位置。 此位置可能因 Outlook 客户端而异。 使用 构造 用法示例: |
target |
REST API 的基 URL (当前 使用 构造 用法示例: |
属性详细信息
delegatePermissions
委托对共享文件夹或用户对共享邮箱拥有的权限。
delegatePermissions: MailboxEnums.DelegatePermissions;
属性值
示例
function performOperation() {
Office.context.mailbox.getCallbackTokenAsync({
isRest: true
},
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Succeeded && asyncResult.value !== "") {
Office.context.mailbox.item.getSharedPropertiesAsync({
// Pass auth token along.
asyncContext: asyncResult.value
},
function (asyncResult1) {
let sharedProperties = asyncResult1.value;
let delegatePermissions = sharedProperties.delegatePermissions;
// Determine if user can do the expected operation.
// E.g., do they have Write permission?
if ((delegatePermissions & Office.MailboxEnums.DelegatePermissions.Write) != 0) {
// Construct REST URL for your operation.
// Update <version> placeholder with actual Outlook REST API version e.g. "v2.0".
// Update <operation> placeholder with actual operation.
let rest_url = sharedProperties.targetRestUrl + "/<version>/users/" + sharedProperties.targetMailbox + "/<operation>";
$.ajax({
url: rest_url,
dataType: 'json',
headers:
{
"Authorization": "Bearer " + asyncResult1.asyncContext
}
}
).done(
function (response) {
console.log("success");
}
).fail(
function (error) {
console.log("error message");
}
);
}
}
);
}
}
);
}
owner
共享项目所有者的电子邮件地址。
owner: string;
属性值
string
targetMailbox
供代理人访问的所有者邮箱的位置。 此位置可能因 Outlook 客户端而异。
使用 构造 targetRestUrl
REST 操作的 URL。
用法示例: targetRestUrl + "/{api_version}/users/" + targetMailbox + "/{REST_operation}"
targetMailbox: string;
属性值
string
targetRestUrl
REST API 的基 URL (当前 https://outlook.office.com/api
) 。
使用 构造 targetMailbox
REST 操作的 URL。
用法示例: targetRestUrl + "/{api_version}/users/" + targetMailbox + "/{REST_operation}"
targetRestUrl: string;
属性值
string