
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
@microsoft/msgraph-sdk-drives
Advanced tools
@microsoft/msgraph-sdk-drives
Get started with the Microsoft Graph SDK for TypeScript by integrating the Microsoft Graph API into your TypeScript application!
This package provides a fluent API for interacting with Microsoft Graph administrative functions.
[!NOTE] This package allows you to build applications using the v1.0 of Microsoft Graph. If you want to try the latest Microsoft Graph APIs, use our beta SDK instead.
To install the package, use npm:
# this will install the authentication provider for Azure Identity / Microsoft Entra
npm install @microsoft/kiota-authentication-azure @azure/identity
# this will install the fluent API package for the administrative API paths
npm install @microsoft/msgraph-sdk-drives
Note: we are working to add the getting started information for Typescript to our public documentation, in the meantime the following sample should help you getting started.
Register your application by following the steps at Register your app with the Microsoft Identity Platform.
An instance of the GraphServiceClient class handles building client. To create a new instance of this class, you need to provide an instance of AuthenticationProvider, which can authenticate requests to Microsoft Graph.
// @azure/identity
const credential = new AuthorizationCodeCredential(
'YOUR_TENANT_ID',
'YOUR_CLIENT_ID',
'YOUR_CLIENT_SECRET',
'AUTHORIZATION_CODE',
'REDIRECT_URL',
);
// @microsoft/kiota-authentication-azure
const authProvider = new AzureIdentityAuthenticationProvider(credential, ["User.Read"]);
// @azure/identity
const credential = new ClientCertificateCredential(
'YOUR_TENANT_ID',
'YOUR_CLIENT_ID',
'YOUR_CERTIFICATE_PATH',
);
// @microsoft/kiota-authentication-azure
const authProvider = new AzureIdentityAuthenticationProvider(credential, ["https://graph.microsoft.com/.default"]);
// @azure/identity
const credential = new ClientSecretCredential(
'YOUR_TENANT_ID',
'YOUR_CLIENT_ID',
'YOUR_CLIENT_SECRET',
);
// @microsoft/kiota-authentication-azure
const authProvider = new AzureIdentityAuthenticationProvider(credential, ["https://graph.microsoft.com/.default"]);
// @azure/identity
const credential = new OnBehalfOfCredential({
tenantId: 'YOUR_TENANT_ID',
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
userAssertionToken: 'JWT_TOKEN_TO_EXCHANGE',
});
// @microsoft/kiota-authentication-azure
const authProvider = new AzureIdentityAuthenticationProvider(credential, ["https://graph.microsoft.com/.default"]);
// @azure/identity
const credential = new DeviceCodeCredential({
tenantId: 'YOUR_TENANT_ID',
clientId: 'YOUR_CLIENT_ID',
userPromptCallback: (info) => {
console.log(info.message);
},
});
// @microsoft/kiota-authentication-azure
const authProvider = new AzureIdentityAuthenticationProvider(credential, ["User.Read"]);
// @azure/identity
const credential = new InteractiveBrowserCredential({
tenantId: 'YOUR_TENANT_ID',
clientId: 'YOUR_CLIENT_ID',
redirectUri: 'http://localhost',
});
// @microsoft/kiota-authentication-azure
const authProvider = new AzureIdentityAuthenticationProvider(credential, ["User.Read"]);
// @azure/identity
const credential = new UsernamePasswordCredential(
'YOUR_TENANT_ID',
'YOUR_CLIENT_ID',
'YOUR_USER_NAME',
'YOUR_PASSWORD',
);
// @microsoft/kiota-authentication-azure
const authProvider = new AzureIdentityAuthenticationProvider(credential, ["User.Read"]);
You must get a GraphServiceClient object to make requests against the service.
const requestAdapter = new GraphRequestAdapter(authProvider);
const graphServiceClient = createGraphServiceClient(requestAdapter);
After you have a GraphServiceClient that is authenticated, you can begin making calls against the service. The requests against the service look like our REST API.
To retrieve the user's detailed information:
import { createGraphServiceClient, GraphRequestAdapter } from "@microsoft/msgraph-sdk";
import "@microsoft/msgraph-sdk-drives"
const requestAdapter = new GraphRequestAdapter(authProvider);
const graphServiceClient = createGraphServiceClient(requestAdapter);
const drives = graphServiceClient.drives.get();
For more detailed documentation, see:
For known issues, see issues.
The Microsoft Graph SDK is open for contribution. To contribute to this project, see Contributing.
Licensed under the MIT license.
FAQs
Drives fluent API for Microsoft Graph
The npm package @microsoft/msgraph-sdk-drives receives a total of 154 weekly downloads. As such, @microsoft/msgraph-sdk-drives popularity was classified as not popular.
We found that @microsoft/msgraph-sdk-drives demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.