{"id":16243184,"url":"https://github.com/svrooij/msgraph-sdk-dotnet-batching","last_synced_at":"2026-04-29T00:34:14.718Z","repository":{"id":97846045,"uuid":"608578034","full_name":"svrooij/msgraph-sdk-dotnet-batching","owner":"svrooij","description":"Microsoft Graph Service Client batching extensions","archived":false,"fork":false,"pushed_at":"2023-03-14T22:57:46.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-19T18:33:58.265Z","etag":null,"topics":["dotnet","hacktogether","microsoft-graph-api","microsoft-graph-sdk"],"latest_commit_sha":null,"homepage":"https://svrooij.io/2023/03/03/batching-in-microsoft-graph/","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/svrooij.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"svrooij"}},"created_at":"2023-03-02T10:02:36.000Z","updated_at":"2025-01-09T01:16:23.000Z","dependencies_parsed_at":"2023-04-25T03:19:09.355Z","dependency_job_id":null,"html_url":"https://github.com/svrooij/msgraph-sdk-dotnet-batching","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"588c9eea88ccd319395bec75c0f5c8ab9e3dc534"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/svrooij/msgraph-sdk-dotnet-batching","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svrooij%2Fmsgraph-sdk-dotnet-batching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svrooij%2Fmsgraph-sdk-dotnet-batching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svrooij%2Fmsgraph-sdk-dotnet-batching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svrooij%2Fmsgraph-sdk-dotnet-batching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/svrooij","download_url":"https://codeload.github.com/svrooij/msgraph-sdk-dotnet-batching/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/svrooij%2Fmsgraph-sdk-dotnet-batching/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32405901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["dotnet","hacktogether","microsoft-graph-api","microsoft-graph-sdk"],"created_at":"2024-10-10T14:14:01.726Z","updated_at":"2026-04-29T00:34:14.700Z","avatar_url":"https://github.com/svrooij.png","language":"C#","funding_links":["https://github.com/sponsors/svrooij"],"categories":[],"sub_categories":[],"readme":"# SvRooij.Graph.Batching\n\n[![nuget][badge_nuget]][link_nuget]\n[![github issues][badge_issues]][link_issues]\n[![github stars][badge_repo_stars]][link_repo]\n[![Language][badge_language]][link_repo]\n[![License][badge_license]][link_repo]\n[![github sponsor][badge_sponsor]][link_sponsor]\n\nThe Microsoft Graph Client [has](https://learn.microsoft.com/en-us/graph/sdks/batch-requests?tabs=csharp) support for Batching, which is a great idea when you are doing a lot of requests to the Graph API. By batching requests you can achieve much higher throughput.\n\nThe original batch implementation in the GraphServiceClient feels incomplete, by default the GraphServiceClient let's you combine up to 20 requests before throwing an exception.\n\nBy using this [extension](#introducing-the-batchrequestcontentcollection) you can combine \"unlimited\" requests and have this library automatically split up the requests in multiple batches. While staying very close to the original implementation.\n\n[![Hackathon][badge_hackathon]][link_hackathon]\n\nThis project was starting during the [Hack Together: Microsoft Graph and .NET][link_hackathon]\n\n[![Watch the video](https://img.youtube.com/vi/u9buNZxbSNk/hqdefault.jpg)](https://youtu.be/u9buNZxbSNk)\n\n## Superseded by Microsoft.Graph.Core 3.0.1  \n\nAfter the release of this extension to the Graph SDK, it got a lot of attention, so I decided to create a PR for the SDK itself. Today, March 7th they released `Microsoft.Graph.Core` version 3.0.1 which included the code that was also in this extension. The extension will get one last update, to deprecate all code and refer to the official sdk. [More details](https://svrooij.io/2023/03/03/batching-in-microsoft-graph/)\n\n## Batching with Microsoft Graph\n\nThis library stays really close to the [build-in batch support](https://learn.microsoft.com/en-us/graph/sdks/batch-requests?tabs=csharp) so go ahead and read that documentation before hand.\n\n```csharp\n// Create a GraphServiceClient with your required IAuthenticationProvider\nvar graphClient = new GraphServiceClient(...);\n\n// Create a BatchRequestContent (your batch request container)\nvar batchRequestContent = new BatchRequestContent(graphClient);\n\n// Add two or more (but max 20) requests to it\nvar getRequest1 = await batchRequestContent.AddBatchRequestStepAsync(graphClient.Me.ToGetRequestInformation());\nvar getRequest2 = await batchRequestContent.AddBatchRequestStepAsync(graphClient.Me.ToGetRequestInformation());\n\n// Execute the batch request\nvar response = await graphClient.Batch.PostAsync(batchRequestContent);\n\n// Do something with the result\nvar user = await response.GetResponseByIdAsync\u003cUser\u003e(getRequest1);\nConsole.WriteLine(\"Hi {0}\", user.DisplayName);\n```\n\n## Introducing the BatchRequestContentCollection\n\nInstead of creating a **BatchRequestContent**, you now create a **BatchRequestContentCollection** and continue using it as before.\n\n```csharp\n// Create a GraphServiceClient with your required IAuthenticationProvider\nvar graphClient = new GraphServiceClient(...);\n\n// Create a BatchRequestContentCollection (your batch request container)\nvar batchRequestContent = new BatchRequestContentCollection(graphClient);\n\n// Add two or more requests to it\n// If you add more then 20 they will be spitted across multiple batch requests automatically.\nvar getRequest1 = await batchRequestContent.AddBatchRequestStepAsync(graphClient.Me.ToGetRequestInformation());\nvar getRequest2 = await batchRequestContent.AddBatchRequestStepAsync(graphClient.Me.ToGetRequestInformation());\n\n// Execute all the batch requests\nvar response = await graphClient.Batch.PostAsync(batchRequestContent);\n\n// Do something with the result\nvar user = await response.GetResponseByIdAsync\u003cUser\u003e(getRequest1);\n...\n```\n\n## Things to keep in mind\n\n- You **cannot** combine requests to multiple tenants in a single batch.\n- You **cannot** combine requests to `beta` and `v1` endpoints.\n- You should test wether or not batching results in higher speeds.\n\nRegular batching support request dependencies, because you don't know if the requests are put in the same batch, you should be careful depending on those.\n\n## About the author\n\n[![LinkedIn Profile][badge_linkedin]][link_linkedin]\n[![Link Mastodon][badge_mastodon]][link_mastodon]\n[![Follow on Twitter][badge_twitter]][link_twitter]\n[![Check my blog][badge_blog]][link_blog]\n\nI like building applications and am somewhat of a Microsoft Graph API expert. I used this knowledge to build this batching helper. But I'm only human so please validate, and if you find an [issue][link_issues] please let me know. If you like this extension give me a shout out on [twitter @svrooij][link_twitter]. You can also [follow my blog][link_blog] if you're interested in these sort of projects\n\n[badge_hackathon]: https://img.shields.io/badge/Microsoft%20365-Hackathon-orange?style=for-the-badge\u0026logo=microsoft\n[link_hackathon]: https://github.com/microsoft/hack-together\n\n[badge_blog]: https://img.shields.io/badge/blog-svrooij.io-blue?style=for-the-badge\n[badge_linkedin]: https://img.shields.io/badge/LinkedIn-stephanvanrooij-blue?style=for-the-badge\u0026logo=linkedin\n[badge_mastodon]: https://img.shields.io/mastodon/follow/109502876771613420?domain=https%3A%2F%2Fdotnet.social\u0026label=%40svrooij%40dotnet.social\u0026logo=mastodon\u0026logoColor=white\u0026style=for-the-badge\n[badge_twitter]: https://img.shields.io/badge/follow-%40svrooij-1DA1F2?logo=twitter\u0026style=for-the-badge\u0026logoColor=white\n[link_blog]: https://svrooij.io/\n[link_linkedin]: https://www.linkedin.com/in/stephanvanrooij\n[link_mastodon]: https://dotnet.social/@svrooij\n[link_twitter]: https://twitter.com/svrooij\n\n[badge_nuget]: https://img.shields.io/nuget/v/SvRooij.Graph.Batching?logo=nuget\u0026style=for-the-badge\n[badge_language]: https://img.shields.io/badge/language-C%23-blue?style=for-the-badge\n[badge_license]: https://img.shields.io/github/license/svrooij/msgraph-sdk-dotnet-batching?style=for-the-badge\n[badge_issues]: https://img.shields.io/github/issues/svrooij/msgraph-sdk-dotnet-batching?style=for-the-badge\n[badge_repo_stars]: https://img.shields.io/github/stars/svrooij/msgraph-sdk-dotnet-batching?logo=github\u0026style=for-the-badge\n[badge_sponsor]: https://img.shields.io/github/sponsors/svrooij?logo=github\u0026style=for-the-badge\n[link_issues]: https://github.com/svrooij/msgraph-sdk-dotnet-batching/issues\n[link_nuget]: https://www.nuget.org/packages/SvRooij.Graph.Batching/\n[link_repo]: https://github.com/svrooij/msgraph-sdk-dotnet-batching\n[link_sponsor]: https://github.com/sponsors/svrooij","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvrooij%2Fmsgraph-sdk-dotnet-batching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsvrooij%2Fmsgraph-sdk-dotnet-batching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsvrooij%2Fmsgraph-sdk-dotnet-batching/lists"}