Skip to content

Commit 9971b68

Browse files
[Outlook] (spam reporting) Add code snippets (#2215)
* Add snippets * Apply suggestion from review Co-authored-by: Elizabeth Samuel <[email protected]> * Run build script --------- Co-authored-by: Elizabeth Samuel <[email protected]>
1 parent 1d7134c commit 9971b68

File tree

5 files changed

+164
-42
lines changed

5 files changed

+164
-42
lines changed

docs/code-snippets/outlook-snippets.yaml

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1903,12 +1903,12 @@ Office.SpamReportingEventCompletedOptions:interface:
19031903
// Run additional processing operations here.
19041904
19051905
/**
1906-
* Signals that the spam-reporting event has completed processing.
1907-
* It then moves the reported message to a custom mailbox folder named "Reported Messages"
1908-
* and shows a post-processing dialog to the user.
1909-
* If an error occurs while the message is being processed, the `onErrorDeleteItem`
1910-
* property determines whether the message will be deleted.
1911-
*/
1906+
* Signals that the spam-reporting event has completed processing.
1907+
* It then moves the reported message to a custom mailbox folder named "Reported Messages"
1908+
* and shows a post-processing dialog to the user.
1909+
* If an error occurs while the message is being processed, the `onErrorDeleteItem`
1910+
* property determines whether the message will be deleted.
1911+
*/
19121912
const event = asyncResult.asyncContext;
19131913
event.completed({
19141914
moveItemTo: Office.MailboxEnums.MoveSpamItemTo.CustomFolder,
@@ -1921,6 +1921,42 @@ Office.SpamReportingEventCompletedOptions:interface:
19211921
});
19221922
});
19231923
}
1924+
Office.SpamReportingEventCompletedOptions#commandId:member:
1925+
- |-
1926+
function onSpamReport(event) {
1927+
// Run operations to process the reported message.
1928+
1929+
/**
1930+
* Signals that the spam-reporting event has completed processing.
1931+
* A task pane is opened instead of showing a post-processing dialog.
1932+
* Context data is then passed to the task pane for processing.
1933+
* To ensure that the task pane opens and receives the context data,
1934+
* the reported message mustn't be moved from the folder in which it resides.
1935+
*/
1936+
event.completed({
1937+
commandId: "msgReadOpenPaneButton",
1938+
contextData: JSON.stringify({ a: "aValue", b: "bValue" }),
1939+
moveItemTo: Office.MailboxEnums.MoveSpamItemTo.NoMove
1940+
});
1941+
}
1942+
Office.SpamReportingEventCompletedOptions#contextData:member:
1943+
- |-
1944+
function onSpamReport(event) {
1945+
// Run operations to process the reported message.
1946+
1947+
/**
1948+
* Signals that the spam-reporting event has completed processing.
1949+
* A task pane is opened instead of showing a post-processing dialog.
1950+
* Context data is then passed to the task pane for processing.
1951+
* To ensure that the task pane opens and receives the context data,
1952+
* the reported message mustn't be moved from the folder in which it resides.
1953+
*/
1954+
event.completed({
1955+
commandId: "msgReadOpenPaneButton",
1956+
contextData: JSON.stringify({ a: "aValue", b: "bValue" }),
1957+
moveItemTo: Office.MailboxEnums.MoveSpamItemTo.NoMove
1958+
});
1959+
}
19241960
Office.SpamReportingEventCompletedOptions#postProcessingAction:member:
19251961
- |-
19261962
// The following example handles a SpamReporting event to process a reported spam or phishing message.
@@ -1935,10 +1971,10 @@ Office.SpamReportingEventCompletedOptions#postProcessingAction:member:
19351971
// Run additional processing operations here.
19361972
19371973
/**
1938-
* Signals that the spam-reporting event has completed processing.
1939-
* It then moves the reported message to the Junk Email folder of the mailbox and shows a
1940-
* post-processing dialog to the user.
1941-
*/
1974+
* Signals that the spam-reporting event has completed processing.
1975+
* It then moves the reported message to the Junk Email folder of the mailbox and shows a
1976+
* post-processing dialog to the user.
1977+
*/
19421978
const event = asyncResult.asyncContext;
19431979
event.completed({
19441980
postProcessingAction: "moveToSpamFolder",

docs/docs-ref-autogen/outlook/outlook/office.spamreportingeventcompletedoptions.yml

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ remarks: >-
3939
// Run additional processing operations here.
4040
4141
/**
42-
* Signals that the spam-reporting event has completed processing.
43-
* It then moves the reported message to a custom mailbox folder named "Reported Messages"
44-
* and shows a post-processing dialog to the user.
45-
* If an error occurs while the message is being processed, the `onErrorDeleteItem`
46-
* property determines whether the message will be deleted.
47-
*/
42+
* Signals that the spam-reporting event has completed processing.
43+
* It then moves the reported message to a custom mailbox folder named "Reported Messages"
44+
* and shows a post-processing dialog to the user.
45+
* If an error occurs while the message is being processed, the `onErrorDeleteItem`
46+
* property determines whether the message will be deleted.
47+
*/
4848
const event = asyncResult.asyncContext;
4949
event.completed({
5050
moveItemTo: Office.MailboxEnums.MoveSpamItemTo.CustomFolder,
@@ -112,6 +112,31 @@ properties:
112112
113113
- If you implement a task pane to open after a reported message is processed, when the `event.completed` call
114114
occurs, any task pane that's open or pinned is closed.
115+
116+
117+
#### Examples
118+
119+
120+
```TypeScript
121+
122+
function onSpamReport(event) {
123+
// Run operations to process the reported message.
124+
125+
/**
126+
* Signals that the spam-reporting event has completed processing.
127+
* A task pane is opened instead of showing a post-processing dialog.
128+
* Context data is then passed to the task pane for processing.
129+
* To ensure that the task pane opens and receives the context data,
130+
* the reported message mustn't be moved from the folder in which it resides.
131+
*/
132+
event.completed({
133+
commandId: "msgReadOpenPaneButton",
134+
contextData: JSON.stringify({ a: "aValue", b: "bValue" }),
135+
moveItemTo: Office.MailboxEnums.MoveSpamItemTo.NoMove
136+
});
137+
}
138+
139+
```
115140
isPreview: true
116141
isDeprecated: false
117142
syntax:
@@ -170,6 +195,31 @@ properties:
170195
`Office.context.mailbox.item.getInitializationContextAsync` in the JavaScript implementation of your task pane. If
171196
you create a JSON string using `JSON.stringify()` and assign it to the `contextData` property, you must parse the
172197
string using `JSON.parse()` once you retrieve it.
198+
199+
200+
#### Examples
201+
202+
203+
```TypeScript
204+
205+
function onSpamReport(event) {
206+
// Run operations to process the reported message.
207+
208+
/**
209+
* Signals that the spam-reporting event has completed processing.
210+
* A task pane is opened instead of showing a post-processing dialog.
211+
* Context data is then passed to the task pane for processing.
212+
* To ensure that the task pane opens and receives the context data,
213+
* the reported message mustn't be moved from the folder in which it resides.
214+
*/
215+
event.completed({
216+
commandId: "msgReadOpenPaneButton",
217+
contextData: JSON.stringify({ a: "aValue", b: "bValue" }),
218+
moveItemTo: Office.MailboxEnums.MoveSpamItemTo.NoMove
219+
});
220+
}
221+
222+
```
173223
isPreview: true
174224
isDeprecated: false
175225
syntax:
@@ -362,10 +412,10 @@ properties:
362412
// Run additional processing operations here.
363413
364414
/**
365-
* Signals that the spam-reporting event has completed processing.
366-
* It then moves the reported message to the Junk Email folder of the mailbox and shows a
367-
* post-processing dialog to the user.
368-
*/
415+
* Signals that the spam-reporting event has completed processing.
416+
* It then moves the reported message to the Junk Email folder of the mailbox and shows a
417+
* post-processing dialog to the user.
418+
*/
369419
const event = asyncResult.asyncContext;
370420
event.completed({
371421
postProcessingAction: "moveToSpamFolder",

docs/docs-ref-autogen/outlook_1_14/outlook/office.spamreportingeventcompletedoptions.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ remarks: >-
3939
// Run additional processing operations here.
4040
4141
/**
42-
* Signals that the spam-reporting event has completed processing.
43-
* It then moves the reported message to a custom mailbox folder named "Reported Messages"
44-
* and shows a post-processing dialog to the user.
45-
* If an error occurs while the message is being processed, the `onErrorDeleteItem`
46-
* property determines whether the message will be deleted.
47-
*/
42+
* Signals that the spam-reporting event has completed processing.
43+
* It then moves the reported message to a custom mailbox folder named "Reported Messages"
44+
* and shows a post-processing dialog to the user.
45+
* If an error occurs while the message is being processed, the `onErrorDeleteItem`
46+
* property determines whether the message will be deleted.
47+
*/
4848
const event = asyncResult.asyncContext;
4949
event.completed({
5050
moveItemTo: Office.MailboxEnums.MoveSpamItemTo.CustomFolder,
@@ -244,10 +244,10 @@ properties:
244244
// Run additional processing operations here.
245245
246246
/**
247-
* Signals that the spam-reporting event has completed processing.
248-
* It then moves the reported message to the Junk Email folder of the mailbox and shows a
249-
* post-processing dialog to the user.
250-
*/
247+
* Signals that the spam-reporting event has completed processing.
248+
* It then moves the reported message to the Junk Email folder of the mailbox and shows a
249+
* post-processing dialog to the user.
250+
*/
251251
const event = asyncResult.asyncContext;
252252
event.completed({
253253
postProcessingAction: "moveToSpamFolder",

generate-docs/API Coverage Report.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9616,8 +9616,8 @@ Office.SpamReportingEventArgs,"freeText",Property,Good,false
96169616
Office.SpamReportingEventArgs,"options",Property,Good,false
96179617
Office.SpamReportingEventArgs,"type",Property,Good,false
96189618
Office.SpamReportingEventCompletedOptions,N/A,Class,Good,true
9619-
Office.SpamReportingEventCompletedOptions,"commandId",Property,Good,false
9620-
Office.SpamReportingEventCompletedOptions,"contextData",Property,Good,false
9619+
Office.SpamReportingEventCompletedOptions,"commandId",Property,Good,true
9620+
Office.SpamReportingEventCompletedOptions,"contextData",Property,Good,true
96219621
Office.SpamReportingEventCompletedOptions,"folderName",Property,Good,false
96229622
Office.SpamReportingEventCompletedOptions,"moveItemTo",Property,Good,false
96239623
Office.SpamReportingEventCompletedOptions,"onErrorDeleteItem",Property,Good,false

generate-docs/script-inputs/local-repo-snippets.yaml

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9588,12 +9588,12 @@ Office.SpamReportingEventCompletedOptions:interface:
95889588
// Run additional processing operations here.
95899589
95909590
/**
9591-
* Signals that the spam-reporting event has completed processing.
9592-
* It then moves the reported message to a custom mailbox folder named "Reported Messages"
9593-
* and shows a post-processing dialog to the user.
9594-
* If an error occurs while the message is being processed, the `onErrorDeleteItem`
9595-
* property determines whether the message will be deleted.
9596-
*/
9591+
* Signals that the spam-reporting event has completed processing.
9592+
* It then moves the reported message to a custom mailbox folder named "Reported Messages"
9593+
* and shows a post-processing dialog to the user.
9594+
* If an error occurs while the message is being processed, the `onErrorDeleteItem`
9595+
* property determines whether the message will be deleted.
9596+
*/
95979597
const event = asyncResult.asyncContext;
95989598
event.completed({
95999599
moveItemTo: Office.MailboxEnums.MoveSpamItemTo.CustomFolder,
@@ -9606,6 +9606,42 @@ Office.SpamReportingEventCompletedOptions:interface:
96069606
});
96079607
});
96089608
}
9609+
Office.SpamReportingEventCompletedOptions#commandId:member:
9610+
- |-
9611+
function onSpamReport(event) {
9612+
// Run operations to process the reported message.
9613+
9614+
/**
9615+
* Signals that the spam-reporting event has completed processing.
9616+
* A task pane is opened instead of showing a post-processing dialog.
9617+
* Context data is then passed to the task pane for processing.
9618+
* To ensure that the task pane opens and receives the context data,
9619+
* the reported message mustn't be moved from the folder in which it resides.
9620+
*/
9621+
event.completed({
9622+
commandId: "msgReadOpenPaneButton",
9623+
contextData: JSON.stringify({ a: "aValue", b: "bValue" }),
9624+
moveItemTo: Office.MailboxEnums.MoveSpamItemTo.NoMove
9625+
});
9626+
}
9627+
Office.SpamReportingEventCompletedOptions#contextData:member:
9628+
- |-
9629+
function onSpamReport(event) {
9630+
// Run operations to process the reported message.
9631+
9632+
/**
9633+
* Signals that the spam-reporting event has completed processing.
9634+
* A task pane is opened instead of showing a post-processing dialog.
9635+
* Context data is then passed to the task pane for processing.
9636+
* To ensure that the task pane opens and receives the context data,
9637+
* the reported message mustn't be moved from the folder in which it resides.
9638+
*/
9639+
event.completed({
9640+
commandId: "msgReadOpenPaneButton",
9641+
contextData: JSON.stringify({ a: "aValue", b: "bValue" }),
9642+
moveItemTo: Office.MailboxEnums.MoveSpamItemTo.NoMove
9643+
});
9644+
}
96099645
Office.SpamReportingEventCompletedOptions#postProcessingAction:member:
96109646
- |-
96119647
// The following example handles a SpamReporting event to process a reported spam or phishing message.
@@ -9620,10 +9656,10 @@ Office.SpamReportingEventCompletedOptions#postProcessingAction:member:
96209656
// Run additional processing operations here.
96219657
96229658
/**
9623-
* Signals that the spam-reporting event has completed processing.
9624-
* It then moves the reported message to the Junk Email folder of the mailbox and shows a
9625-
* post-processing dialog to the user.
9626-
*/
9659+
* Signals that the spam-reporting event has completed processing.
9660+
* It then moves the reported message to the Junk Email folder of the mailbox and shows a
9661+
* post-processing dialog to the user.
9662+
*/
96279663
const event = asyncResult.asyncContext;
96289664
event.completed({
96299665
postProcessingAction: "moveToSpamFolder",

0 commit comments

Comments
 (0)