Class UpdateDraftActionResponse
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
อัปเดตร่างการดําเนินการคําตอบ
แสดงการดำเนินการที่อัปเดตอีเมลฉบับร่างที่ผู้ใช้กำลังแก้ไขอยู่
// An UpdateDraftActionResponse that inserts a list of To recipients into an
// email draft
let updateDraftActionResponse =
CardService.newUpdateDraftActionResponseBuilder()
.setUpdateToRecipientsAction(
CardService.newUpdateToRecipientsAction().addUpdateToRecipients([
'joe@example.com',
'wen@example.com',
]),
)
.build();
// An UpdateDraftActionResponse that inserts a list of Cc recipients into an
// email draft
updateDraftActionResponse =
CardService.newUpdateDraftActionResponseBuilder()
.setUpdateCcRecipientsAction(
CardService.newUpdateCcRecipientsAction().addUpdateCcRecipients([
'joe@example.com',
'wen@example.com',
]),
)
.build()
// An UpdateDraftActionResponse that inserts a list of Bcc recipients
// into an email draft
.setUpdateCcRecipientsAction(
CardService.newUpdateBccRecipientsAction().addUpdateBccRecipients([
'joe@example.com',
'wen@example.com',
]),
);
// An UpdateDraftActionResponse that inserts a subject line into an email draft
updateDraftActionResponse =
CardService.newUpdateDraftActionResponseBuilder()
.setUpdateDraftSubjectAction(
CardService.newUpdateDraftSubjectAction().addUpdateSubject(
'example subject',
),
)
.build();
// An UpdateDraftActionResponse that inserts non-editable content (a link in
// this case) into an email draft.
updateDraftActionResponse =
CardService.newUpdateDraftActionResponseBuilder()
.setUpdateDraftBodyAction(
CardService.newUpdateDraftBodyAction()
.addUpdateContent(
'<a href="https://www.google.com">Google</a>',
CardService.ContentType.IMMUTABLE_HTML,
)
.setUpdateType(CardService.UpdateDraftBodyType.IN_PLACE_INSERT),
)
.build();
// An UpdateDraftActionResponse that inserts a link into an email draft. The
// added content can be edited further.
updateDraftActionResponse =
CardService.newUpdateDraftActionResponseBuilder()
.setUpdateDraftBodyAction(
CardService.newUpdateDraftBodyAction()
.addUpdateContent(
'<a href="https://www.google.com">Google</a>',
CardService.ContentType.MUTABLE_HTML,
)
.setUpdateType(CardService.UpdateDraftBodyType.IN_PLACE_INSERT),
)
.build();
// An UpdateDraftActionResponse that inserts multiple values of different types.
// The example action response inserts two lines next to each other in the email
// draft, at the cursor position. Each line contains the content added by
// {@link UpdateDraftActionResponseBuilder#addUpdateContent}.
updateDraftActionResponse =
CardService.newUpdateDraftActionResponseBuilder()
.setUpdateDraftBodyAction(
CardService.newUpdateDraftBodyAction()
.addUpdateContent(
'<a href="https://www.google.com">Google</a>',
CardService.ContentType.MUTABLE_HTML,
)
.addUpdateContent(
'Above is a google link.', CardService.ContentType.PLAIN_TEXT)
.setUpdateType(CardService.UpdateDraftBodyType.IN_PLACE_INSERT),
)
.build();
เมธอด
วิธีการ | ประเภทการแสดงผล | รายละเอียดแบบย่อ |
printJson() | String | พิมพ์การแสดง JSON ของออบเจ็กต์นี้ |
เอกสารประกอบโดยละเอียด
printJson()
พิมพ์การแสดง JSON ของออบเจ็กต์นี้ การดำเนินการนี้มีไว้สำหรับการแก้ไขข้อบกพร่องเท่านั้น
รีเทิร์น
String
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003e\u003ccode\u003eUpdateDraftActionResponse\u003c/code\u003e allows you to programmatically modify email drafts, such as adding recipients, subject lines, and content.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to update To, Cc, Bcc recipients, subject, and email body content with either mutable or immutable HTML/plain text.\u003c/p\u003e\n"],["\u003cp\u003eYou can insert content at the cursor position, allowing for dynamic email composition within your add-on.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eprintJson()\u003c/code\u003e is available for debugging purposes to examine the object's structure in JSON format.\u003c/p\u003e\n"]]],[],null,["# Class UpdateDraftActionResponse\n\nUpdateDraftActionResponse\n\nRepresents an action that updates the email draft that the user is currently editing.\n\n```javascript\n// An UpdateDraftActionResponse that inserts a list of To recipients into an\n// email draft\nlet updateDraftActionResponse =\n CardService.newUpdateDraftActionResponseBuilder()\n .setUpdateToRecipientsAction(\n CardService.newUpdateToRecipientsAction().addUpdateToRecipients([\n 'joe@example.com',\n 'wen@example.com',\n ]),\n )\n .build();\n\n// An UpdateDraftActionResponse that inserts a list of Cc recipients into an\n// email draft\nupdateDraftActionResponse =\n CardService.newUpdateDraftActionResponseBuilder()\n .setUpdateCcRecipientsAction(\n CardService.newUpdateCcRecipientsAction().addUpdateCcRecipients([\n 'joe@example.com',\n 'wen@example.com',\n ]),\n )\n .build()\n\n // An UpdateDraftActionResponse that inserts a list of Bcc recipients\n // into an email draft\n .setUpdateCcRecipientsAction(\n CardService.newUpdateBccRecipientsAction().addUpdateBccRecipients([\n 'joe@example.com',\n 'wen@example.com',\n ]),\n );\n\n// An UpdateDraftActionResponse that inserts a subject line into an email draft\nupdateDraftActionResponse =\n CardService.newUpdateDraftActionResponseBuilder()\n .setUpdateDraftSubjectAction(\n CardService.newUpdateDraftSubjectAction().addUpdateSubject(\n 'example subject',\n ),\n )\n .build();\n\n// An UpdateDraftActionResponse that inserts non-editable content (a link in\n// this case) into an email draft.\nupdateDraftActionResponse =\n CardService.newUpdateDraftActionResponseBuilder()\n .setUpdateDraftBodyAction(\n CardService.newUpdateDraftBodyAction()\n .addUpdateContent(\n '\u003ca href=\"https://www.google.com\"\u003eGoogle\u003c/a\u003e',\n CardService.ContentType.IMMUTABLE_HTML,\n )\n .setUpdateType(CardService.UpdateDraftBodyType.IN_PLACE_INSERT),\n )\n .build();\n\n// An UpdateDraftActionResponse that inserts a link into an email draft. The\n// added content can be edited further.\nupdateDraftActionResponse =\n CardService.newUpdateDraftActionResponseBuilder()\n .setUpdateDraftBodyAction(\n CardService.newUpdateDraftBodyAction()\n .addUpdateContent(\n '\u003ca href=\"https://www.google.com\"\u003eGoogle\u003c/a\u003e',\n CardService.ContentType.MUTABLE_HTML,\n )\n .setUpdateType(CardService.UpdateDraftBodyType.IN_PLACE_INSERT),\n )\n .build();\n\n// An UpdateDraftActionResponse that inserts multiple values of different types.\n// The example action response inserts two lines next to each other in the email\n// draft, at the cursor position. Each line contains the content added by\n// {@link UpdateDraftActionResponseBuilder#addUpdateContent}.\nupdateDraftActionResponse =\n CardService.newUpdateDraftActionResponseBuilder()\n .setUpdateDraftBodyAction(\n CardService.newUpdateDraftBodyAction()\n .addUpdateContent(\n '\u003ca href=\"https://www.google.com\"\u003eGoogle\u003c/a\u003e',\n CardService.ContentType.MUTABLE_HTML,\n )\n .addUpdateContent(\n 'Above is a google link.', CardService.ContentType.PLAIN_TEXT)\n .setUpdateType(CardService.UpdateDraftBodyType.IN_PLACE_INSERT),\n )\n .build();\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------|-------------|------------------------------------------------|\n| [printJson()](#printJson()) | `String` | Prints the JSON representation of this object. |\n\nDetailed documentation\n----------------------\n\n### `print``Json()`\n\nPrints the JSON representation of this object. This is for debugging only.\n\n#### Return\n\n\n`String`"]]