Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@microsoft/microsoft-graph-types-beta
Advanced tools
Beta version of Typings for Microsoft Graph objects
The Microsoft Graph TypeScript definitions enable editors to provide intellisense on Microsoft Graph /beta endpoint objects including users, messages, and groups.
NOTE: APIs under the /beta version in Microsoft Graph are subject to change.
We recommend including the .d.ts file by downloading this package through npm.
# Install types and save in package.json as a development dependency
npm install @microsoft/microsoft-graph-types-beta --save-dev
The following examples assume that you have a valid access token. The following example uses isomorphic-fetch and Microsoft Graph JavaScript client library -
import { User } from "@microsoft/microsoft-graph-types-beta";
import { Client } from "@microsoft/microsoft-graph-client";
import 'isomorphic-fetch';
const client = Client.initWithMiddleware({
defaultVersion: 'beta',
...
});
const response = await client.api("/me").get();
const user = response as User;
// 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:MicrosoftGraphBeta.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"
}
}
"devDependencies": {
// import published v1.0 types with a version from NPM
"@microsoft/microsoft-graph-types": "^0.4.0",
// import beta types with a version from NPM
"@microsoft/microsoft-graph-types-beta": "^0.1.0-preview"
}
}
import * as MicrosoftGraph from "@microsoft/microsoft-graph-types"
import * as MicrosoftGraphBeta from "@microsoft/microsoft-graph-types-beta"
const v1User: MicrosoftGraph.User = {
givenName: "V1 User"
}
const betaUser: MicrosoftGraphBeta.User = {
givenName: "Beta User"
}
Any TypeScript project can consume these types when using at least TypeScript 2.0. We've tested including the types as a dependency in the following editors.
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) 2021 Microsoft. All rights reserved.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
FAQs
Beta version of Typings for Microsoft Graph objects
We found that @microsoft/microsoft-graph-types-beta demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.