@@ -501,6 +501,14 @@ Office.Auth:interface:
501
501
console.log("Error obtaining token", result.error);
502
502
}
503
503
});
504
+ Office.Auth#getAuthContext:member(1):
505
+ - |-
506
+ try{
507
+ const authContext = await Office.auth.getAuthContext();
508
+ console.log(authContext.userPrincipalName);
509
+ } catch (error) {
510
+ console.log("Error obtaining token", error);
511
+ }
504
512
Office.Auth#getAccessToken:member(1):
505
513
- |-
506
514
try{
@@ -4035,6 +4043,102 @@ Office.Settings#set:member(1):
4035
4043
function setMySetting() {
4036
4044
Office.context.document.settings.set('mySetting', 'mySetting value');
4037
4045
}
4046
+ Office.SharedProperties:interface :
4047
+ - |-
4048
+ function performOperation() {
4049
+ Office.context.mailbox.getCallbackTokenAsync({
4050
+ isRest: true
4051
+ },
4052
+ function (asyncResult) {
4053
+ if (asyncResult.status === Office.AsyncResultStatus.Succeeded && asyncResult.value !== "") {
4054
+ Office.context.mailbox.item.getSharedPropertiesAsync({
4055
+ // Pass auth token along.
4056
+ asyncContext: asyncResult.value
4057
+ },
4058
+ function (asyncResult1) {
4059
+ let sharedProperties = asyncResult1.value;
4060
+ let delegatePermissions = sharedProperties.delegatePermissions;
4061
+
4062
+ // Determine if user can do the expected operation.
4063
+ // E.g., do they have Write permission?
4064
+ if ((delegatePermissions & Office.MailboxEnums.DelegatePermissions.Write) != 0) {
4065
+ // Construct REST URL for your operation.
4066
+ // Update <version> placeholder with actual Outlook REST API version e.g. "v2.0".
4067
+ // Update <operation> placeholder with actual operation.
4068
+ let rest_url = sharedProperties.targetRestUrl + "/<version>/users/" + sharedProperties.targetMailbox + "/<operation>";
4069
+
4070
+ $.ajax({
4071
+ url: rest_url,
4072
+ dataType: 'json',
4073
+ headers:
4074
+ {
4075
+ "Authorization": "Bearer " + asyncResult1.asyncContext
4076
+ }
4077
+ }
4078
+ ).done(
4079
+ function (response) {
4080
+ console.log("success");
4081
+ }
4082
+ ).fail(
4083
+ function (error) {
4084
+ console.log("error message");
4085
+ }
4086
+ );
4087
+ }
4088
+ }
4089
+ );
4090
+ }
4091
+ }
4092
+ );
4093
+ }
4094
+ Office.SharedProperties#delegatePermissions:member:
4095
+ - |-
4096
+ function performOperation() {
4097
+ Office.context.mailbox.getCallbackTokenAsync({
4098
+ isRest: true
4099
+ },
4100
+ function (asyncResult) {
4101
+ if (asyncResult.status === Office.AsyncResultStatus.Succeeded && asyncResult.value !== "") {
4102
+ Office.context.mailbox.item.getSharedPropertiesAsync({
4103
+ // Pass auth token along.
4104
+ asyncContext: asyncResult.value
4105
+ },
4106
+ function (asyncResult1) {
4107
+ let sharedProperties = asyncResult1.value;
4108
+ let delegatePermissions = sharedProperties.delegatePermissions;
4109
+
4110
+ // Determine if user can do the expected operation.
4111
+ // E.g., do they have Write permission?
4112
+ if ((delegatePermissions & Office.MailboxEnums.DelegatePermissions.Write) != 0) {
4113
+ // Construct REST URL for your operation.
4114
+ // Update <version> placeholder with actual Outlook REST API version e.g. "v2.0".
4115
+ // Update <operation> placeholder with actual operation.
4116
+ let rest_url = sharedProperties.targetRestUrl + "/<version>/users/" + sharedProperties.targetMailbox + "/<operation>";
4117
+
4118
+ $.ajax({
4119
+ url: rest_url,
4120
+ dataType: 'json',
4121
+ headers:
4122
+ {
4123
+ "Authorization": "Bearer " + asyncResult1.asyncContext
4124
+ }
4125
+ }
4126
+ ).done(
4127
+ function (response) {
4128
+ console.log("success");
4129
+ }
4130
+ ).fail(
4131
+ function (error) {
4132
+ console.log("error message");
4133
+ }
4134
+ );
4135
+ }
4136
+ }
4137
+ );
4138
+ }
4139
+ }
4140
+ );
4141
+ }
4038
4142
Office.TableBinding#addColumnsAsync:member(1):
4039
4143
- |-
4040
4144
// The following example adds a single column with three rows to a bound table with the id "myTable"
0 commit comments