Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
microsoft-graph-typings
Advanced tools
The Microsoft Graph TypeScript definitions enable editors to provide intellisense on Microsoft Graph objects.
The Microsoft Graph TypeScript definitions enable editors to provide intellisense on Microsoft Graph objects.
You can use Microsoft Graph definitions in your project in a few ways:
/// <reference path="microsoft-graph.d.ts" />
.The following examples assume that you have a valid access token. We used superagent to perform the HTTP requests, but you can use our JavaScript SDK or other libraries as well.
import * as request from 'superagent';
const accessToken:string = "";
request
.get("https://graph.microsoft.com/v1.0/me/messages")
.set('Authorization', 'Bearer ' + accessToken)
.end((err, res) => {
if (err) {
console.error(err)
return;
}
let messages:[MicrosoftGraph.Message] = res.body.value;
for (let msg of messages) { //iterate through the recent messages
console.log(msg.subject);
console.log(msg.toRecipients[0].emailAddress.address);
}
})
// Create the message object
// Note that all the properties must follow the interface definitions.
// For example, this will not compile if you try to type "xml" instead of "html" for contentType.
let mail:MicrosoftGraph.Message = {
subject: "Microsoft Graph TypeScript Sample",
toRecipients: [{
emailAddress: {
address: "microsoftgraph@example.com"
}
}],
body: {
content: "<h1>Microsoft Graph TypeScript Sample</h1>Try modifying the sample",
contentType: "html"
}
}
// send the email by sending a POST request to the Microsoft Graph
request
.post('https://graph.microsoft.com/v1.0/users/me/sendMail')
.send({message: mail})
.set('Authorization', 'Bearer ' + accessToken)
.end((err, res) => {
if (err) {
console.error(err)
return;
}
console.log(res)
})
All DateTimeOffset values are returned as strings from Microsoft Graph and should be wrapped in new Date()
at runtime.
let me:MicrosoftGraph.User = {}; // result from graph
let myBirthday = new Date(me.birthday);
console.log(myBirthday.toDateString());
We'd love to get your feedback about the TypeScript definitions project. You can send your questions and suggestions to us in the Issues section of this repository.
Please see the contributing guidelines.
Copyright (c) 2016 Microsoft. All rights reserved.
FAQs
Types for Microsoft Graph objects
The npm package microsoft-graph-typings receives a total of 7 weekly downloads. As such, microsoft-graph-typings popularity was classified as not popular.
We found that microsoft-graph-typings demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.