Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmsharepoint/abc375ddd1110a259cd4610fdcb10cb7 to your computer and use it in GitHub Desktop.
Save mmsharepoint/abc375ddd1110a259cd4610fdcb10cb7 to your computer and use it in GitHub Desktop.
export default class GraphController {
private client: MSGraphClient;
private metadataExtensionName = 'mmsharepoint.onmicrosoft.MailStorage';
public saveMailMetadata(mailId: string, displayName: string, url: string, savedDate: Date) {
const apiUrl = `/me/messages/${mailId}/extensions`;
const metadataBody = {
"@odata.type" : "microsoft.graph.openTypeExtension",
"extensionName" : this.metadataExtensionName,
"saveDisplayName" : displayName,
"saveUrl" : url,
"savedDate" : savedDate.toISOString()
};
this.client
.api(apiUrl)
.version('v1.0')
.post(JSON.stringify(metadataBody))
.then((response) => {
console.log(response);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment