-
Notifications
You must be signed in to change notification settings - Fork 2
/
office.body.yml
549 lines (377 loc) · 29.2 KB
/
office.body.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
### YamlMime:TSType
name: Office.Body
uid: outlook!Office.Body:interface
package: outlook!
fullName: Office.Body
summary: L’objet body fournit des méthodes pour ajouter et mettre à jour le contenu du message ou du rendez-vous. Il est renvoyé dans la propriété body de l’élément sélectionné.
remarks: >-
\[[Ensemble d’API : Mailbox 1.1](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**Problème connu avec les couleurs de bordure de tableau HTML**
Outlook sur Windows : si vous devez définir différentes bordures de cellule sur différentes couleurs dans un tableau HTML en mode Composition, les bordures d’une cellule risquent de ne pas refléter la couleur attendue. Pour connaître le comportement connu, [consultez le problème OfficeDev/office-js \# 1818](https://github.com/OfficeDev/office-js/issues/1818)<!-- -->.
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!-- -->** : Rédiger ou Lire
isPreview: false
isDeprecated: false
type: interface
methods:
- name: getAsync(coercionType, options, callback)
uid: outlook!Office.Body#getAsync:member(1)
package: outlook!
fullName: getAsync(coercionType, options, callback)
summary: >-
Renvoie le corps actif dans un format spécifié.
Cette méthode renvoie l’intégralité du corps actuel au format spécifié par `coercionType`<!-- -->.
Lorsque vous travaillez avec des corps au format HTML, il est important de noter que les méthodes et les méthodes ne sont `Body.getAsync` `Body.setAsync` pas idempotentes. La valeur renvoyée par la méthode ne sera pas nécessairement identique à celle qui a été passée précédemment `getAsync` dans `setAsync` la méthode. Le client peut modifier la valeur transmise afin de le rendre `setAsync` efficacement avec son moteur de rendu.
remarks: >-
\[[Ensemble d’API : Mailbox 1.3](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!-- -->** : Rédiger ou Lire
#### <a name="examples"></a>Exemples
```javascript
// This example gets the body of the item as plain text.
Office.context.mailbox.item.body.getAsync(
"text",
{ asyncContext: "This is passed to the callback" },
function callback(result) {
// Do something with the result.
});
// The following is an example of the result parameter passed to the callback function.
{
"value": "TEXT of whole body (including threads below)",
"status": "succeeded",
"asyncContext": "This is passed to the callback"
}
```
isPreview: false
isDeprecated: false
syntax:
content: 'getAsync(coercionType: Office.CoercionType | string, options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<string>) => void): void;'
parameters:
- id: coercionType
description: Format du corps renvoyé.
type: <xref uid="office!Office.CoercionType:enum" /> | string
- id: options
description: 'Littéral d’objet qui contient une ou plusieurs des propriétés suivantes : `asyncContext`<!-- -->: les développeurs peuvent fournir n’importe quel objet à accéder dans la méthode de rappel.'
type: <xref uid="office!Office.AsyncContextOptions:interface" />
- id: callback
description: Facultatif. Une fois la méthode terminée, la fonction passée dans le paramètre est appelée avec un seul paramètre `callback` de type Office. AsyncResult. Le corps est fourni au format demandé dans la `asyncResult.value` propriété.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><string>) => void'
return:
type: void
description: ''
- name: getAsync(coercionType, callback)
uid: outlook!Office.Body#getAsync:member(2)
package: outlook!
fullName: getAsync(coercionType, callback)
summary: >-
Renvoie le corps actif dans un format spécifié.
Cette méthode renvoie l’intégralité du corps actuel au format spécifié par `coercionType`<!-- -->.
Lorsque vous travaillez avec des corps au format HTML, il est important de noter que les méthodes et les méthodes ne sont `Body.getAsync` `Body.setAsync` pas idempotentes. La valeur renvoyée par la méthode ne sera pas nécessairement identique à celle qui a été passée précédemment `getAsync` dans `setAsync` la méthode. Le client peut modifier la valeur transmise afin de le rendre `setAsync` efficacement avec son moteur de rendu.
remarks: >-
\[[Ensemble d’API : Mailbox 1.3](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points)<!-- -->** : Rédiger ou Lire
isPreview: false
isDeprecated: false
syntax:
content: 'getAsync(coercionType: Office.CoercionType | string, callback?: (asyncResult: Office.AsyncResult<string>) => void): void;'
parameters:
- id: coercionType
description: Format du corps renvoyé.
type: <xref uid="office!Office.CoercionType:enum" /> | string
- id: callback
description: Facultatif. Une fois la méthode terminée, la fonction passée dans le paramètre est appelée avec un seul paramètre `callback` de type Office. AsyncResult. Le corps est fourni au format demandé dans la `asyncResult.value` propriété.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><string>) => void'
return:
type: void
description: ''
- name: getTypeAsync(options, callback)
uid: outlook!Office.Body#getTypeAsync:member(1)
package: outlook!
fullName: getTypeAsync(options, callback)
summary: Obtient une valeur qui indique si le contenu est au format HTML ou texte.
remarks: >-
\[[Ensemble d’API : Mailbox 1.1](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points) <!-- -->**: Composer
#### <a name="examples"></a>Exemples
```javascript
Office.context.mailbox.item.body.getTypeAsync(function (asyncResult) {
if (asyncResult.status === "failed") {
console.log("Action failed with error: " + asyncResult.error.message);
} else {
console.log("Body type: " + asyncResult.value);
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'getTypeAsync(options: Office.AsyncContextOptions, callback?: (asyncResult: Office.AsyncResult<Office.CoercionType>) => void): void;'
parameters:
- id: options
description: 'Littéral d’objet contenant une ou plusieurs des propriétés suivantes. `asyncContext`<!-- -->: les développeurs peuvent fournir n’importe quel objet à accéder dans la méthode de rappel.'
type: <xref uid="office!Office.AsyncContextOptions:interface" />
- id: callback
description: Facultatif. Une fois la méthode terminée, la fonction passée dans le paramètre est appelée avec `callback` un seul paramètre de type `Office.AsyncResult`<!-- -->. Le type de contenu est renvoyé en tant que l’une des `CoercionType` valeurs de la `asyncResult.value` propriété.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><<xref uid="office!Office.CoercionType:enum" />>) => void'
return:
type: void
description: ''
- name: getTypeAsync(callback)
uid: outlook!Office.Body#getTypeAsync:member(2)
package: outlook!
fullName: getTypeAsync(callback)
summary: Obtient une valeur qui indique si le contenu est au format HTML ou texte.
remarks: >-
\[[Ensemble d’API : Mailbox 1.1](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points) <!-- -->**: Composer
isPreview: false
isDeprecated: false
syntax:
content: 'getTypeAsync(callback?: (asyncResult: Office.AsyncResult<Office.CoercionType>) => void): void;'
parameters:
- id: callback
description: Facultatif. Une fois la méthode terminée, la fonction passée dans le paramètre est appelée avec `callback` un seul paramètre de type `Office.AsyncResult`<!-- -->. Le type de contenu est renvoyé en tant que l’une des `CoercionType` valeurs de la `asyncResult.value` propriété.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><<xref uid="office!Office.CoercionType:enum" />>) => void'
return:
type: void
description: ''
- name: prependAsync(data, options, callback)
uid: outlook!Office.Body#prependAsync:member(1)
package: outlook!
fullName: prependAsync(data, options, callback)
summary: >-
Ajoute le contenu spécifié au début du corps de l’élément.
La méthode `prependAsync` insère la chaîne spécifiée au début du corps de l’élément. Après l’insertion, le curseur est renvoyé à son endroit d’origine, par rapport au contenu inséré.
Lorsque vous travaillez avec des corps au format HTML, il est important de noter que le client peut modifier la valeur transmise afin de la rendre plus efficace avec son moteur `prependAsync` de rendu. Cela signifie que la valeur renvoyée par un appel ultérieur à la méthode (introduite dans `Body.getAsync` Mailbox 1.3) ne contiendra pas nécessairement exactement la valeur qui a été passée précédemment dans la `prependAsync` méthode.
Lorsque vous insérez des liens dans le code HTML, vous pouvez désactiver l’aperçu de lien en ligne en attribuant l’attribut `id` au point d’ancrage (<!-- --><<!-- -->a<!-- -->><!-- -->) à « LPNoLP » (voir la section **Exemples** pour un exemple).
**Recommandé :** `getTypeAsync` l’appel passe ensuite la valeur renvoyée au `options.coercionType` paramètre.
remarks: >-
\[[Ensemble d’API : Mailbox 1.1](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadWriteItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points) <!-- -->**: Composer
**Erreurs**:
- `DataExceedsMaximumSize`<!-- -->: le paramètre de données est plus de 1 000 000 caractères.
#### <a name="examples"></a>Exemples
```javascript
// When including links in HTML markup, you can disable online link preview
// by setting the id attribute on the anchor (<a>) to "LPNoLP".
Office.context.mailbox.item.body.prependAsync(
'<a id="LPNoLP" href="http://www.contoso.com">Click here!</a>',
{coercionType: Office.CoercionType.Html},
callback);
```
isPreview: false
isDeprecated: false
syntax:
content: 'prependAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;'
parameters:
- id: data
description: La chaîne doit être insérée au début du corps. Elle est limitée à un million de caractères.
type: string
- id: options
description: 'Littéral d’objet contenant une ou plusieurs des propriétés suivantes. `asyncContext`<!-- -->: les développeurs peuvent fournir n’importe quel objet à accéder dans la méthode de rappel. `coercionType`<!-- -->: format souhaité pour le corps. La chaîne du paramètre `data` est convertie dans ce format.'
type: <xref uid="office!Office.AsyncContextOptions:interface" /> & <xref uid="outlook!Office.CoercionTypeOptions:interface" />
- id: callback
description: Facultatif. Une fois la méthode terminée, la fonction passée dans le paramètre est appelée avec `callback` un seul paramètre de type `Office.AsyncResult`<!-- -->. Les erreurs rencontrées seront indiquées dans la propriété `asyncResult.error`.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: prependAsync(data, callback)
uid: outlook!Office.Body#prependAsync:member(2)
package: outlook!
fullName: prependAsync(data, callback)
summary: >-
Ajoute le contenu spécifié au début du corps de l’élément.
La méthode `prependAsync` insère la chaîne spécifiée au début du corps de l’élément. Après l’insertion, le curseur est renvoyé à son endroit d’origine, par rapport au contenu inséré.
Lorsque vous travaillez avec des corps au format HTML, il est important de noter que le client peut modifier la valeur transmise afin de la rendre plus efficace avec son moteur `prependAsync` de rendu. Cela signifie que la valeur renvoyée par un appel ultérieur à la méthode (introduite dans `Body.getAsync` Mailbox 1.3) ne contiendra pas nécessairement exactement la valeur qui a été passée précédemment dans la `prependAsync` méthode.
Lorsque vous insérez des liens dans le code HTML, vous pouvez désactiver l’aperçu de lien en ligne en attribuant l’attribut `id` au point d’ancrage (<!-- --><<!-- -->a<!-- -->><!-- -->) à « LPNoLP » (voir la section **Exemples** pour un exemple).
**Recommandé :** `getTypeAsync` l’appel passe ensuite la valeur renvoyée au `options.coercionType` paramètre.
remarks: >-
\[[Ensemble d’API : Mailbox 1.1](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadWriteItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points) <!-- -->**: Composer
**Erreurs**:
- `DataExceedsMaximumSize`<!-- -->: le paramètre de données est plus de 1 000 000 caractères.
isPreview: false
isDeprecated: false
syntax:
content: 'prependAsync(data: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;'
parameters:
- id: data
description: La chaîne doit être insérée au début du corps. Elle est limitée à un million de caractères.
type: string
- id: callback
description: Facultatif. Une fois la méthode terminée, la fonction passée dans le paramètre est appelée avec `callback` un seul paramètre de type `Office.AsyncResult`<!-- -->. Les erreurs rencontrées seront indiquées dans la propriété `asyncResult.error`.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: setAsync(data, options, callback)
uid: outlook!Office.Body#setAsync:member(1)
package: outlook!
fullName: setAsync(data, options, callback)
summary: >-
Remplace l’ensemble du corps avec le texte spécifié.
Lorsque vous travaillez avec des corps au format HTML, il est important de noter que les méthodes et les méthodes ne sont `Body.getAsync` `Body.setAsync` pas idempotentes. La valeur renvoyée par la méthode ne sera pas nécessairement identique à celle qui a été passée précédemment `getAsync` dans `setAsync` la méthode. Le client peut modifier la valeur transmise afin de le rendre `setAsync` efficacement avec son moteur de rendu.
Lorsque vous insérez des liens dans le code HTML, vous pouvez désactiver l’aperçu de lien en ligne en attribuant l’attribut `id` au point d’ancrage (<!-- --><<!-- -->a<!-- -->><!-- -->) à « LPNoLP » (voir la section **Exemples** pour un exemple).
**Recommandé :** `getTypeAsync` l’appel passe ensuite la valeur renvoyée au `options.coercionType` paramètre.
**Important**: dans Outlook sur Windows et sur Mac, l’utilisateur du add-in ne peut pas annuler cette action avec la **commande Annuler.**
remarks: >-
\[[Ensemble d’API : Mailbox 1.3](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadWriteItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points) <!-- -->**: Composer
**Erreurs**:
- `DataExceedsMaximumSize`<!-- -->: le paramètre de données est plus de 1 000 000 caractères.
- `InvalidFormatError`<!-- -->: le `options.coercionType` paramètre est paramétrable `Office.CoercionType.Html` et le corps du message est en texte simple.
#### <a name="examples"></a>Exemples
```javascript
// When including links in HTML markup, you can disable online link preview
// by setting the id attribute on the anchor (<a>) to "LPNoLP".
Office.context.mailbox.item.body.setAsync(
'<a id="LPNoLP" href="http://www.contoso.com">Click here!</a>',
{coercionType: Office.CoercionType.Html},
callback);
Office.context.mailbox.item.body.setAsync(
"<b>(replaces all body, including threads you are replying to that may be on the bottom)</b>",
{ coercionType: "html", asyncContext: "This is passed to the callback" },
function callback(result) {
// Process the result.
});
// The following is an example of the result parameter passed to the callback function.
{
"value":null,
"status": "succeeded",
"asyncContext": "This is passed to the callback"
}
```
isPreview: false
isDeprecated: false
syntax:
content: 'setAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;'
parameters:
- id: data
description: Chaîne qui remplace le corps existant. Elle est limitée à 1 000 000 caractères.
type: string
- id: options
description: 'Littéral d’objet contenant une ou plusieurs des propriétés suivantes. `asyncContext`<!-- -->: les développeurs peuvent fournir n’importe quel objet à accéder dans la méthode de rappel. `coercionType`<!-- -->: format souhaité pour le corps. La chaîne du paramètre `data` est convertie dans ce format.'
type: <xref uid="office!Office.AsyncContextOptions:interface" /> & <xref uid="outlook!Office.CoercionTypeOptions:interface" />
- id: callback
description: Facultatif. Une fois la méthode terminée, la fonction passée dans le paramètre est appelée avec un seul paramètre `callback` de type Office. AsyncResult. Les erreurs rencontrées seront indiquées dans la propriété `asyncResult.error`.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: setAsync(data, callback)
uid: outlook!Office.Body#setAsync:member(2)
package: outlook!
fullName: setAsync(data, callback)
summary: >-
Remplace l’ensemble du corps avec le texte spécifié.
Lorsque vous travaillez avec des corps au format HTML, il est important de noter que les méthodes et les méthodes ne sont `Body.getAsync` `Body.setAsync` pas idempotentes. La valeur renvoyée par la méthode ne sera pas nécessairement identique à celle qui a été passée précédemment `getAsync` dans `setAsync` la méthode. Le client peut modifier la valeur transmise afin de le rendre `setAsync` efficacement avec son moteur de rendu.
Lorsque vous insérez des liens dans le code HTML, vous pouvez désactiver l’aperçu de lien en ligne en attribuant l’attribut `id` au point d’ancrage (<!-- --><<!-- -->a<!-- -->><!-- -->) à « LPNoLP » (voir la section **Exemples** pour un exemple).
**Recommandé :** `getTypeAsync` l’appel passe ensuite la valeur renvoyée au `options.coercionType` paramètre.
**Important**: dans Outlook sur Windows et sur Mac, l’utilisateur du add-in ne peut pas annuler cette action avec la **commande Annuler.**
remarks: >-
\[[Ensemble d’API : Mailbox 1.3](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadWriteItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points) <!-- -->**: Composer
**Erreurs**:
- `DataExceedsMaximumSize`<!-- -->: le paramètre de données est plus de 1 000 000 caractères.
- `InvalidFormatError`<!-- -->: le `options.coercionType` paramètre est paramétrable `Office.CoercionType.Html` et le corps du message est en texte simple.
isPreview: false
isDeprecated: false
syntax:
content: 'setAsync(data: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;'
parameters:
- id: data
description: Chaîne qui remplace le corps existant. Elle est limitée à 1 000 000 caractères.
type: string
- id: callback
description: Facultatif. Une fois la méthode terminée, la fonction passée dans le paramètre est appelée avec un seul paramètre `callback` de type Office. AsyncResult. Les erreurs rencontrées seront indiquées dans la propriété `asyncResult.error`.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: setSelectedDataAsync(data, options, callback)
uid: outlook!Office.Body#setSelectedDataAsync:member(1)
package: outlook!
fullName: setSelectedDataAsync(data, options, callback)
summary: >-
Remplace la sélection dans le corps par le texte spécifié.
La méthode `setSelectedDataAsync` insère la chaîne spécifiée à l’emplacement du curseur dans le corps de l’élément ou, si du texte est sélectionné dans l’éditeur, elle remplace ce texte. Si le curseur ne s’est jamais trouvé dans le corps de l’élément, ou si le corps de l’élément n’est plus la partie active de l’interface utilisateur, la chaîne est insérée au début du corps de l’élément. Après l’insertion, le curseur est placé à la fin du contenu inséré.
Lorsque vous insérez des liens dans le code HTML, vous pouvez désactiver l’aperçu de lien en ligne en setting the id attribute on the anchor (<!-- --><<!-- -->a<!-- -->><!-- -->) à « LPNoLP » (voir la section **Exemples** pour un exemple).
**Recommandé :** `getTypeAsync` l’appel passe ensuite la valeur renvoyée au `options.coercionType` paramètre.
remarks: >-
\[[Ensemble d’API : Mailbox 1.1](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadWriteItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points) <!-- -->**: Composer
**Erreurs**:
- `DataExceedsMaximumSize`<!-- -->: `data` le paramètre est plus de 1 000 000 caractères.
- `InvalidFormatError`<!-- -->: le `options.coercionType` paramètre est paramétrable `Office.CoercionType.Html` et le corps du message est en texte simple.
#### <a name="examples"></a>Exemples
```javascript
// When including links in HTML markup, you can disable online link preview
// by setting the id attribute on the anchor (<a>) to "LPNoLP".
Office.context.mailbox.item.body.setSelectedDataAsync(
'<a id="LPNoLP" href="http://www.contoso.com">Click here!</a>',
{coercionType: Office.CoercionType.Html},
callback);
```
isPreview: false
isDeprecated: false
syntax:
content: 'setSelectedDataAsync(data: string, options: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;'
parameters:
- id: data
description: Chaîne qui remplace le corps existant. Elle est limitée à 1 000 000 caractères.
type: string
- id: options
description: 'Littéral d’objet contenant une ou plusieurs des propriétés suivantes. `asyncContext`<!-- -->: les développeurs peuvent fournir n’importe quel objet à accéder dans la méthode de rappel. `coercionType`<!-- -->: format souhaité pour le corps. La chaîne du paramètre `data` est convertie dans ce format.'
type: <xref uid="office!Office.AsyncContextOptions:interface" /> & <xref uid="outlook!Office.CoercionTypeOptions:interface" />
- id: callback
description: Facultatif. Une fois la méthode terminée, la fonction passée dans le paramètre est appelée avec `callback` un seul paramètre de type `Office.AsyncResult`<!-- -->. Les erreurs rencontrées seront indiquées dans la propriété `asyncResult.error`.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: setSelectedDataAsync(data, callback)
uid: outlook!Office.Body#setSelectedDataAsync:member(2)
package: outlook!
fullName: setSelectedDataAsync(data, callback)
summary: >-
Remplace la sélection dans le corps par le texte spécifié.
La méthode `setSelectedDataAsync` insère la chaîne spécifiée à l’emplacement du curseur dans le corps de l’élément ou, si du texte est sélectionné dans l’éditeur, elle remplace ce texte. Si le curseur ne s’est jamais trouvé dans le corps de l’élément, ou si le corps de l’élément n’est plus la partie active de l’interface utilisateur, la chaîne est insérée au début du corps de l’élément. Après l’insertion, le curseur est placé à la fin du contenu inséré.
Lorsque vous insérez des liens dans le code HTML, vous pouvez désactiver l’aperçu de lien en ligne en setting the id attribute on the anchor (<!-- --><<!-- -->a<!-- -->><!-- -->) à « LPNoLP » (voir la section **Exemples** pour un exemple).
**Recommandé :** `getTypeAsync` l’appel passe ensuite la valeur renvoyée au `options.coercionType` paramètre.
remarks: >-
\[[Ensemble d’API : Mailbox 1.1](/office/dev/add-ins/reference/requirement-sets/outlook-api-requirement-sets) \]
**[Niveau d’autorisation minimal](https://docs.microsoft.com/office/dev/add-ins/outlook/understanding-outlook-add-in-permissions) <!-- -->**:`ReadWriteItem`
**[Mode Outlook applicable](https://docs.microsoft.com/office/dev/add-ins/outlook/outlook-add-ins-overview#extension-points) <!-- -->**: Composer
**Erreurs**:
- `DataExceedsMaximumSize`<!-- -->: `data` le paramètre est plus de 1 000 000 caractères.
- `InvalidFormatError`<!-- -->: le `options.coercionType` paramètre est paramétrable `Office.CoercionType.Html` et le corps du message est en texte simple.
isPreview: false
isDeprecated: false
syntax:
content: 'setSelectedDataAsync(data: string, callback?: (asyncResult: Office.AsyncResult<void>) => void): void;'
parameters:
- id: data
description: Chaîne qui remplace le corps existant. Elle est limitée à 1 000 000 caractères.
type: string
- id: callback
description: Facultatif. Une fois la méthode terminée, la fonction passée dans le paramètre est appelée avec `callback` un seul paramètre de type `Office.AsyncResult`<!-- -->. Les erreurs rencontrées seront indiquées dans la propriété `asyncResult.error`.
type: '(asyncResult: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
metadata:
ms.openlocfilehash: 75d2c0195d16a950fd66fca78458158c1938920d
ms.sourcegitcommit: 19dde6bc8de58ebd0bd96cb63d1fce314eae7098
ms.translationtype: MT
ms.contentlocale: fr-FR
ms.lasthandoff: 11/17/2021
ms.locfileid: "61060830"