Edits history of script submission #23354 for ' Send Draft (outlook)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    /**
     * Send Draft
     * Send an existing draft message. Requires Mail.Send (a connection default).
     */
    export async function main(
      auth: RT.Outlook,
      message_id: string,
      mailbox: string | undefined
    ) {
      const base = `https://graph.microsoft.com/v1.0/${
        mailbox != null && mailbox !== ""
          ? `users/${encodeURIComponent(mailbox)}`
          : "me"
      }`
      const response = await fetch(
        `${base}/messages/${encodeURIComponent(message_id)}/send`,
        {
          method: "POST",
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/json",
          },
        }
      )
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      // 202 Accepted with an empty body
      return { success: true }
    }
    

    Submitted by hugo989 6 hours ago

  • bunnative
    //native
    
    /**
     * Send Draft
     * Send an existing draft message. Requires Mail.Send (the connection default).
     */
    export async function main(
      auth: RT.Outlook,
      message_id: string,
      mailbox: string | undefined
    ) {
      const base = `https://graph.microsoft.com/v1.0/${
        mailbox != null && mailbox !== ""
          ? `users/${encodeURIComponent(mailbox)}`
          : "me"
      }`
      const response = await fetch(
        `${base}/messages/${encodeURIComponent(message_id)}/send`,
        {
          method: "POST",
          headers: {
            Authorization: `Bearer ${auth.token}`,
            Accept: "application/json",
          },
        }
      )
    
      if (!response.ok) {
        throw new Error(`${response.status} ${await response.text()}`)
      }
    
      // 202 Accepted with an empty body
      return { success: true }
    }
    

    Submitted by hugo989 6 hours ago