New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/microsoft-graph-types

Package Overview
Dependencies
Maintainers
3
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/microsoft-graph-types - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

4

package.json
{
"name": "@microsoft/microsoft-graph-types",
"description": "Types for Microsoft Graph objects",
"version": "1.4.0",
"version": "1.5.0",
"types": "microsoft-graph.d.ts",

@@ -23,2 +23,2 @@ "scripts": {

}
}
}

@@ -20,7 +20,7 @@ [![npm version badge](https://img.shields.io/npm/v/@microsoft/microsoft-graph-types.svg)](https://www.npmjs.com/package/@microsoft/microsoft-graph-types)

## Examples
The following examples assume that you have a valid access token. We used [superagent](https://github.com/visionmedia/superagent) to perform the HTTP requests, but you can use [our JavaScript client library](https://github.com/microsoftgraph/msgraph-sdk-javascript) or other libraries as well.
The following examples assume that you have a valid access token. We used [isomorphic-fetch](https://www.npmjs.com/package/isomorphic-fetch) to perform requests, but you can use [our JavaScript client library](https://github.com/microsoftgraph/msgraph-sdk-javascript) or other libraries as well.
```typescript
import * as MicrosoftGraph from "@microsoft/microsoft-graph-types"
import * as request from 'superagent';
import * from 'isomorphic-fetch';
const accessToken:string = "";

@@ -30,11 +30,14 @@ ```

```typescript
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;
let url = "https://graph.microsoft.com/v1.0/me/messages";
let request = new Request(url, {
method: "GET",
headers: new Headers({
"Authorization": "Bearer " + accessToken
})
});
fetch(request)
.then((response) => {
response.json().then((res) => {
let messages:[MicrosoftGraph.Message] = res.value;
for (let msg of messages) { //iterate through the recent messages

@@ -44,4 +47,8 @@ console.log(msg.subject);

}
});
})
})
.catch((error) => {
console.error(error);
});
```

@@ -68,9 +75,25 @@ ### Send an email as the logged in user

// 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) => {
console.log(res)
})
let url = "https://graph.microsoft.com/v1.0/users/me/sendMail";
let request = new Request(
url, {
method: "POST",
body: JSON.stringify({
message: mail
}),
headers: new Headers({
"Authorization": "Bearer " + accessToken,
'Content-Type': 'application/json'
})
}
);
fetch(request)
.then((response) => {
if(response.ok === true) {
console.log("Mail sent successfully..!!");
}
})
.catch((err) => {
console.error(err);
});

@@ -77,0 +100,0 @@ ```

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc