Project for the Build Microsoft Graph connectors with .NET learn module
MIT License
This project contains a Microsoft Graph connector. Using Graph connectors you can import external data into Microsoft 365 and Microsoft Search. Ingested content is available to Microsoft Copilot for Microsoft 365, Microsoft Search and other Microsoft 365 services.
When developing the Graph connector, you can use Dev Proxy to simulate Microsoft Graph API responses. This allows you to develop and test the connector without having to connect to the Microsoft Graph API and wait for the connection to be provisioned/removed.
./setup.ps1
.ConnectionConfiguration.cs
:
ContentService.cs
:
Document
class to match the schema you defined previouslyExtract
method to load the content to importGetDocId
method to generate a unique ID for each documentTransform
method that convert documents from the external system into Microsoft Graph external items, with the schema you defined previouslyresultLayout.json
:
dotnet build
dotnet run -- create-connection
(this will take several minutes)dotnet run -- load-content
If you want to simulate Microsoft Graph API responses using Dev Proxy:
devproxy
Ctrl+C
to stop Dev Proxy.
├── .devproxy
│ └── graph-connector-mocks.json
├── .vscode
│ ├── extensions.json
│ ├── launch.json
│ └── tasks.json
├── CompleteJobWithDelayHandler.cs
├── ConnectionConfiguration.cs
├── ConnectionService.cs
├── ContentService.cs
├── DebugRequestHandler.cs
├── DebugResponseHandler.cs
├── GraphService.cs
├── MsGraphDocs.csproj
├── Program.cs
├── devproxyrc.json
├── resultLayout.json
└── setup.ps1
Dev Proxy Microsoft Graph API mocks for the Graph connector.
Visual Studio Code configuration files.
Microsoft Graph SDK Middleware to handle the long-running job of provisioning the connection's schema. The middleware waits for the job to complete before continuing. It waits the recommended 60 seconds before checking the job status.
Graph connector configuration. You can define the schema for the external items, the URL to the item resolvers, and the connection name.
Code to create the external connection and provision the schema.
Code to load content to import. The code is organized following the Extract-Transform-Load (ETL) principle.
Microsoft Graph SDK Middleware to log requests and responses to the console. Disabled by default. Enable in the GraphService.cs file.
Microsoft Graph SDK client instantiation code.
Main entry point that defines the commands to create the connection and load content.
Dev Proxy configuration for use with the project.
Result layout (Adaptive Card) for Microsoft Search.
Setup script to create a new Microsoft Entra app registration using Microsoft Graph PowerShell SDK. You need to install Microsoft Graph PowerShell SDK before using this script.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.