{"id":28524851,"url":"https://github.com/microsoftgraph/msgraph-snippets-dotnet","last_synced_at":"2025-07-06T11:31:18.122Z","repository":{"id":171125552,"uuid":"647455472","full_name":"microsoftgraph/msgraph-snippets-dotnet","owner":"microsoftgraph","description":"Repository of snippets in Microsoft Graph .NET SDK documentation.","archived":false,"fork":false,"pushed_at":"2025-06-23T21:39:20.000Z","size":273,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-23T22:39:16.850Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoftgraph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-30T20:27:42.000Z","updated_at":"2025-06-23T21:39:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc8bec7b-0ddc-4953-a69d-90c9b2c66116","html_url":"https://github.com/microsoftgraph/msgraph-snippets-dotnet","commit_stats":null,"previous_names":["microsoftgraph/msgraph-snippets-dotnet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/microsoftgraph/msgraph-snippets-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-snippets-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-snippets-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-snippets-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-snippets-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoftgraph","download_url":"https://codeload.github.com/microsoftgraph/msgraph-snippets-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-snippets-dotnet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263892420,"owners_count":23526087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-09T11:11:45.246Z","updated_at":"2025-07-06T11:31:18.117Z","avatar_url":"https://github.com/microsoftgraph.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microsoft Graph .NET SDK Snippets\n\n[![dotnet build](https://github.com/microsoftgraph/msgraph-snippets-dotnet/actions/workflows/dotnet.yml/badge.svg)](https://github.com/microsoftgraph/msgraph-snippets-dotnet/actions/workflows/dotnet.yml) ![License.](https://img.shields.io/badge/license-MIT-green.svg)\n\nThis repository contains sample snippets for the [Microsoft Graph .NET SDK](https://github.com/microsoftgraph/msgraph-sdk-dotnet). These snippets are referenced in the [Microsoft Graph SDK documentation](https://learn.microsoft.com/graph/sdks/sdks-overview).\n\n## Prerequisites\n\n- [.NET 7](https://dotnet.microsoft.com/download)\n\n## Register an app in Azure Active Directory\n\n1. Open a browser and navigate to the [Microsoft Entra admin center](https://entra.microsoft.com) and login using a **Work or School Account**.\n\n1. Expand **Azure Active Directory** in the left-hand navigation, then expand **Applications**, then select **App registrations**.\n\n1. Select **New registration**. Enter a name for your application, for example, `Graph Snippets`.\n\n1. Set **Supported account types** as desired. The options are:\n\n    | Option | Who can sign in? |\n    |--------|------------------|\n    | **Accounts in this organizational directory only** | Only users in your Microsoft 365 organization |\n    | **Accounts in any organizational directory** | Users in any Microsoft 365 organization (work or school accounts) |\n    | **Accounts in any organizational directory ... and personal Microsoft accounts** | Users in any Microsoft 365 organization (work or school accounts) and personal Microsoft accounts |\n\n1. Leave **Redirect URI** empty.\n\n1. Select **Register**. On the application's **Overview** page, copy the value of the **Application (client) ID** and save it, you will need it in the next step. If you chose **Accounts in this organizational directory only** for **Supported account types**, also copy the **Directory (tenant) ID** and save it.\n\n1. Select **Authentication** under **Manage**. Locate the **Advanced settings** section and change the **Allow public client flows** toggle to **Yes**, then choose **Save**.\n\n## Configuring the sample\n\nYou can set these values directly in [appsettings.json](src/SdkSnippets/appsettings.json), or you can create a copy of **appsettings.json** named **appsettings.Development.json** and set the values there.\n\n1. Set `clientId` to the **Application (client) ID** from your app registration.\n1. If you chose **Accounts in this organizational directory only** for **Supported account types**, set `tenantId` to your **Directory (tenant) ID**.\n\n## Authentication\n\nThe first time you run this sample, it caches the user's authentication record to the file specified in `authCachePath` in **appsettings.json**. This allows the app to silently authenticate on subsequent runs as that same user. If you want to change users, delete the auth cache file (by default, **./src/SdkSnippets/auth-cache.bin**).\n\n## Code of conduct\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoftgraph%2Fmsgraph-snippets-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoftgraph%2Fmsgraph-snippets-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoftgraph%2Fmsgraph-snippets-dotnet/lists"}