title | description | author |
---|---|---|
Javscript examples |
Examples Snippets generated by the api |
andrueastman |
This shows how snippets requests look like for javascript
GET /v1.0/me/events/AAMkAGIAAAoZDOFAAA=?$select=subject,body,bodyPreview,organizer,attendees,start,end,location HTTP/1.1
Host: graph.microsoft.com
Prefer: outlook.timezone="Pacific Standard Time"
const options = {
authProvider,
};
const client = Client.init(options);
let res = await client.api('/me/events/AAMkAGIAAAoZDOFAAA=')
.header('Prefer','outlook.timezone="Pacific Standard Time"')
.select('subject,body,bodyPreview,organizer,attendees,start,end,location')
.get();
POST /v1.0/users HTTP/1.1
Host: graph.microsoft.com
Content-type: application/json
{
"accountEnabled": true,
"displayName": "displayName-value",
"mailNickname": "mailNickname-value",
"userPrincipalName": "[email protected]",
"passwordProfile" : {
"forceChangePasswordNextSignIn": true,
"password": "password-value"
}
}
const options = {
authProvider,
};
const client = Client.init(options);
const user = {
accountEnabled: true,
displayName: "displayName-value",
mailNickname: "mailNickname-value",
userPrincipalName: "[email protected]",
"passwordProfile" : {
forceChangePasswordNextSignIn: true,
password: "password-value"
}
};
let res = await client.api('/users')
.post(user);
PATCH /v1.0/me HTTP/1.1
Host: graph.microsoft.com
Content-type: application/json
Content-length: 491
{
"accountEnabled": true,
"businessPhones": [
"businessPhones-value"
],
"city": "city-value"
}
const options = {
authProvider,
};
const client = Client.init(options);
const me = {
accountEnabled: true,
businessPhones: [
"businessPhones-value"
],
city: "city-value"
};
let res = await client.api('/me')
.update(me);
PUT /beta/applications/{id}/synchronization/templates/{templateId} HTTP/1.1
Host: graph.microsoft.com
Authorization: Bearer <token>
Content-type: application/json
{
"id": "Slack",
"applicationId": "{id}",
"factoryTag": "CustomSCIM"
}
const options = {
authProvider,
};
const client = Client.init(options);
const templates = {
id: "Slack",
applicationId: "{id}",
factoryTag: "CustomSCIM"
};
let res = await client.api('/applications/{id}/synchronization/templates/{templateId}')
.version('beta')
.put(templates);
DELETE /v1.0/me/messages/{id} HTTP/1.1
Host: graph.microsoft.com
const options = {
authProvider,
};
const client = Client.init(options);
let res = await client.api('/me/messages/{id}')
.delete();