Skip to content
Powershell SDK for Graph APIs
C# PowerShell
Branch: dev
Clone or download
Latest commit d11fa1f Aug 6, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Move autorest options to config file Jul 30, 2019
openApiDocs Generate me.Message Jul 30, 2019
scripts Add client credential auth Aug 2, 2019
src Update readme Aug 6, 2019 Fix typos Aug 6, 2019

Microsoft Graph PowerShell SDK

The Microsoft Graph Powershell SDK is collection of PowerShell modules that conatain cmdlets that can be used to make Microsoft Graph REST calls.

Generate Module

  1. Download and install PowerShell.
  2. Install AutoRest.
    npm install -g autorest@beta
  3. Clone msgraph-sdk-powershell.
    git clone -b dev
  4. Generate PowerShell modules by tags. For a complete list of tags, see OpenApiSplice. Due to issue msgraph-openapi-introspection#12, we will add -useLocalOpenApiDoc switch to use a local sanitized OpenAPI document for me.message tag.
    .\scripts\GenerateModules.ps1 -tags "me.message" -useLocalOpenApiDoc
    This generates a Microsoft Graph me.message PowerShell module in .\src\me.message\me.message.

Run Generated Module

  1. Build Generate Module with -Run switch.

    .\src\me.message\me.message\build-module.ps1 -Run 
  2. Import Common Module. For now, we have to manually import Common module which houses cmdlets to handle authentication - Connect-Graph and Disconnect-Graph.

    Import-Module .\src\me.message\me.message\bin\Common.dll  
  3. Authenicate to Azure AD to get an access token to call Microsoft Graph API.

    Connect-Graph -ClientId 'ID' -Scopes ', Calendars.Read, Files.Read'
  4. Call Get-MeMessage cmdlet.

    Get-MeMessage -Top 10 -Skip 10 -Select 'Id, Subject, CreatedDateTime' | Format-Table CreatedDateTime, Subject, Id
You can’t perform that action at this time.