Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Microsoft Graph TypeScript Type Definitions

License

NotificationsYou must be signed in to change notification settings

microsoftgraph/msgraph-typescript-typings

npm version badge

Microsoft Graph TypeScript Types

The Microsoft Graph TypeScript definitions enable editors to provide intellisense on Microsoft Graph objects including users, messages, and groups.

NOTE: TheMicrosoft Graph TypeScript Types Betanpm package andGitHub repo is now available. Imports from themicrosoftgraph/msgraph-typescript-typings#beta branch will no longer be supported.

Installation

We recommend including the .d.ts file by downloading this package throughnpm.

# Install types and save in package.json as a development dependencynpm install @microsoft/microsoft-graph-types --save-dev

GIF showing intellisense and autocompletion for Microsoft Graph entities in Visual Studio Code

Examples

The following examples assume that you have a valid access token. The following example usesisomorphic-fetch andMicrosoft Graph JavaScript client library -

import{User}from"@microsoft/microsoft-graph-types-beta";import{Client}from"@microsoft/microsoft-graph-client";import'isomorphic-fetch';constclient=Client.initWithMiddleware({defaultVersion:'beta',    ...});constresponse=awaitclient.api("/me").get();constuser=responseasUser;

Example of creating an object

// 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.letmail: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"}}

Example of using v1 types and beta types together

"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*asMicrosoftGraphfrom"@microsoft/microsoft-graph-types"import*asMicrosoftGraphBetafrom"@microsoft/microsoft-graph-types-beta"constv1User:MicrosoftGraph.User={givenName:"V1 User"}constbetaUser:MicrosoftGraphBeta.User={givenName:"Beta User"}

Supported editors

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.

Questions and comments

We'd love to get your feedback about the TypeScript definitions project. You can send your questions and suggestions to us in theIssues section of this repository.

Contributing

Please see thecontributing guidelines.

Additional resources

Security Reporting

If you find a security issue with our libraries or services please report it tosecure@microsoft.com with as much detail as possible. Your submission may be eligible for a bounty through theMicrosoft Bounty program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visitingthis page and subscribing to Security Advisory Alerts.

License

Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License (the "License");

We Value and Adhere to the Microsoft Open Source Code of Conduct

This project has adopted theMicrosoft Open Source Code of Conduct. For more information see theCode of Conduct FAQ or contactopencode@microsoft.com with any additional questions or comments.


[8]ページ先頭

©2009-2025 Movatter.jp