LogoLogo
HomePricingDocumentation
  • 💿Getting Started
    • Installation and Project Setup
    • Hello Perigee!
    • Perigee Application Design
    • Hello Configuration
    • Hello Logs
    • Hello Integration
    • Troubleshooting
    • Case Studies
  • 📃License + Notice
    • 📂Licensing
    • Notice of Third Party Agreements
  • 🚀Perigee and Beyond
    • Extending - Threads
    • Extending - Loaders
    • ⏳All about CRON
  • 🔮API Generation
    • What is API Generation?
    • API Builder
  • 🗺️Architecting YOUR App
    • Design and Requirements
    • Define Sources
    • Requirements
  • 🧩Core Modules
    • 🌐PerigeeApplication
    • 🪡Thread Registry
    • Event Sources
      • Scheduled/Logic
        • CRON Thread
        • Scheduler
        • Sync Agent
      • Watchers
        • SalesForce
        • Sharepoint
        • Directory Watch
        • Directory Notifier
        • IMAP
    • Credential Management
      • Connection Strings
      • Custom Refresh Logic
      • RestSharp Authenticator
      • Credential Store SDK
      • ⁉️Troubleshooting Credentials
    • Integration Utilities
      • HTTP(S) - RestSharp
      • Transaction Coordinator
      • Limiter
      • Watermarking
    • Alert Managers
      • SMS
      • Email
      • Discord
      • Teams
    • File Formats
      • Excel
      • CSV
    • 📁File System Storage
      • File Revision Store
      • Concurrent File Store
      • FileSync + Cache
    • Third Party
      • SmartSheets
      • Microsoft Graph
    • Perigee In Parallel
      • Parallel Processing Reference
      • Extensions
      • GroupProcessor
      • SingleProcessor
    • 🧱Utility Classes
      • Metrics
      • F(x) Expressions
      • Multi-Threaded Processor (Scatter Gather)
      • OpenAI - GPT
      • XML Converter
      • Dynamic Data Table
      • Debounce
      • Thread Conditions
      • Perigee Utility Class
      • Network Utility
      • Lists
      • FileUtil
      • Inclusive2DRange
      • Strings, Numbers, Dates
      • Nested Sets
      • Behavior Trees
      • JsonCompress
      • Topological Sorting
      • DBDownloader
    • 🈁Bit Serializer
  • 📣Examples and Demos
    • API + Perigee
    • 📰Excel Quick Load
    • SalesForce Watcher
    • Report Scheduler
    • Agent Data Synchronization
    • 📩IMAP Echo bot
    • Watch and load CSVs
    • Graph Delegated Authorization + DataVerse
    • Coordinator Demo
    • Azure Service Bus
    • QuickBooks Online
  • 📘Blueprints
    • Perigee With .NET Hosting
    • Web Host Utilities
    • 🔌Plugin Load Context
  • 🎞️Transforms
    • 🌟What is Transforms?
    • 📘Terminology
    • 🦾The Mapping Document
    • 👾Transformation Process
    • 😎Profile
    • 🎒Automation
      • 🕓Package Options
      • 🔳Configuration
    • 🔧Utilities
      • 🧹Clean
      • 📑Map File
      • 🔎File Identification
      • 🗺️Map Generation
      • 🪅Insert Statement Generation
  • 🗃️Transform SDK
    • 👋Quick Start Guide
    • 🥳MapTo
    • 🔌Authoring Plugins
      • 🔘File IO Process
      • 📢Data Quality
      • 🟢Transform Process
    • SDK Reference
      • 🔘FileIOProcessData
      • 📢DataQualityContext
      • 🎛️TransformDataContext
      • 🏅TransformResult
Powered by GitBook
On this page
  • Authorization
  • Client_Credentials
  • Authorization_Code + Refresh_Code
  • SDK
  • Custom Graph Call
Export as PDF
  1. Core Modules
  2. Third Party

Microsoft Graph

PreviousSmartSheetsNextPerigee In Parallel

Last updated 2 years ago

There is an included Graph client with two authorization models built right in.

Most of the prebuilt functionality is around the drive, site, lists and teams workloads. However, you can easily extend the functionality if you need something specific!

Authorization

To use either, go to and create an app registration.

Client_Credentials

This authorization type is used when supplying direct application ID/Secrets from a registered application. The registered permissions are usually administratively granted and there is no delegation ("as a user") required.

PerigeeApplication.ApplicationNoInit("Graph", (c) =>
{
    var Graph = new GraphClient("tenant", "appID", "appSecret", c.GetLogger<Program>());
});

That's it! Once you have the client, call other methods:

var site = Graph.GetSiteByPath(new Uri(@"https://company.sharepoint.com/sites/dev1"));
var drive = Graph.GetSiteDrive(site.id);

Authorization_Code + Refresh_Code

This authorization type is best used when you're authorizing a user and your application permissions are assigned as delegated.

A good example of this is a service account authorized to pull a DataVerse table, or read teams messages.

PerigeeApplication.ApplicationNoInit("Graph", (c) =>
{
    //Define client
    var Graph = new GraphClient("tenant", "appID", "appSecret", 
    "offline_access user.read Team.ReadBasic.All", 
    "https://localhost:7201/api/token", 
    "", //Optional domain, leave blank unless talking to dataverse
    c.GetLogger<Program>());

    //Give it the initial code, so it can refresh and retrieve the authorization_code and refresh_code
    CredentialStore.RefreshAuthorizationCode(Graph.credentialName, "CODEHERE");
    
});

And there you have it, once the initial code is supplied the client is automatically maintained from there on out. If a new token is required the refresh token is automatically supplied and you don't have to think about it again!

var teams = Graph.GetJoinedTeams();

Full Demo

To see a full demo including receiving a token from the the response, and awaiting the credentials on load:

SDK

Custom Graph Call

If a method is missing or you need to override functionality, feel free to use the built in call to submit your own call with authorization, credential management, and retries built in.

Use RestGraphCall, as shown below:

var response = Graph.RestGraphCall<GraphAPIModel.Generic.Response>(
    $"/sites/{sync.siteID}/lists/{sync.ListName}", Method.Get);

The SDK methods closely match what's defined in the .

https://portal.azure.com
Graph Delegated Authorization + DataVerse
Graph 1.0 documentation
🧩
Page cover image