Skip to content

Commit

Permalink
Merge pull request #2791 from bcameron1231/fix-2789
Browse files Browse the repository at this point in the history
Fixes Message mapping in Graph sendMail method
  • Loading branch information
juliemturner authored Sep 28, 2023
2 parents 3185337 + e5b90dd commit 25ee3d9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/graph/messages/users.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import { addProp, body } from "@pnp/queryable";
import { _User, User } from "../users/types.js";
import { IMessages, Messages, IMailboxSettings, MailboxSettings, IMailFolders, MailFolders, IMessage } from "./types.js";
import { IMessages, Messages, IMailboxSettings, MailboxSettings, IMailFolders, MailFolders } from "./types.js";
import { graphPost } from "../operations.js";
import { Message } from "@microsoft/microsoft-graph-types";

declare module "../users/types" {
interface _User {
readonly messages: IMessages;
readonly mailboxSettings: IMailboxSettings;
readonly mailFolders: IMailFolders;
sendMail(message: IMessage): Promise<void>;
sendMail(message: Message): Promise<void>;
}
interface IUser {
readonly messages: IMessages;
readonly mailboxSettings: IMailboxSettings;
readonly mailFolders: IMailFolders;
sendMail(message: IMessage): Promise<void>;
sendMail(message: Message): Promise<void>;
}
}

addProp(_User, "messages", Messages);
addProp(_User, "mailboxSettings", MailboxSettings);
addProp(_User, "mailFolders", MailFolders);

_User.prototype.sendMail = function (this: _User, message: IMessage): Promise<void> {
_User.prototype.sendMail = function (message: Message): Promise<void> {
return graphPost(User(this, "sendMail"), body(message));
};

0 comments on commit 25ee3d9

Please sign in to comment.