{"id":6565,"date":"2021-07-26T06:19:57","date_gmt":"2021-07-26T14:19:57","guid":{"rendered":"https:\/\/officedevblogs.wpengine.com\/?p=6565"},"modified":"2021-07-26T06:19:57","modified_gmt":"2021-07-26T14:19:57","slug":"microsoft-graph-net-sdk-v4-now-generally-available-with-streamlined-authentication-and-more","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/microsoft-graph-net-sdk-v4-now-generally-available-with-streamlined-authentication-and-more\/","title":{"rendered":"Microsoft Graph .NET SDK\u00a0v4 now generally available with streamlined authentication and more\u00a0"},"content":{"rendered":"<p><span data-contrast=\"auto\">If you\u00a0already work with\u00a0<\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/overview\"><span data-contrast=\"none\">Microsoft\u00a0Graph<\/span><\/a><span data-contrast=\"auto\">, then you know how powerful it is to\u00a0have a single\u00a0REST\u00a0API to access\u00a0data across\u00a0many\u00a0Microsoft services.\u00a0Microsoft Graph\u00a0.NET\u00a0SDK\u00a0provides\u00a0a fluent API and models\u00a0that\u00a0support retry handling, secure redirects,\u00a0batching requests,\u00a0large file management,\u00a0and\u00a0many\u00a0more\u00a0capabilities.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Today\u00a0we\u2019re announcing the general\u00a0availability (GA) of Microsoft Graph .NET SDK version 4.0.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Along with all the\u00a0features and improvements\u00a0discussed\u00a0in the\u00a0<\/span><a href=\"https:\/\/developer.microsoft.com\/en-us\/office\/blogs\/microsoft-graph-net-sdk-v4-adds-enhanced-features-now-in-preview\/\"><span data-contrast=\"none\">v4 preview announcement<\/span><\/a><span data-contrast=\"auto\">,\u00a0such as single authentication against Microsoft Graph and Azure Identity\u00a0clients\u00a0and\u00a0easy access to response\u00a0information\u00a0through\u00a0the\u00a0<\/span><b><span data-contrast=\"auto\">GraphResponse<\/span><\/b><span data-contrast=\"auto\">\u00a0object,\u00a0this GA release\u00a0also\u00a0delivers the new capabilities\u00a0described below.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h4><span data-contrast=\"none\">Rich notifications\u00a0that\u00a0support encrypted content<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:240,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">The SDK now includes native support to decrypt resource data in rich notifications payloads.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">When creating a subscription,\u00a0Microsoft Graph .NET SDK v4\u00a0users can simply use the\u00a0<\/span><b><span data-contrast=\"auto\">AddPublicEncryptionCertificate<\/span><\/b><span data-contrast=\"auto\">\u00a0method to add a certificate. Once\u00a0the\u00a0subscription is created,\u00a0use\u00a0the\u00a0<\/span><b><span data-contrast=\"auto\">AreTokensValid<\/span><\/b><i><span data-contrast=\"auto\">\u00a0<\/span><\/i><span data-contrast=\"auto\">and\u00a0<\/span><b><span data-contrast=\"auto\">DecryptAsunc<\/span><\/b><span data-contrast=\"auto\">\u00a0functions, to\u00a0respectively\u00a0validate\u00a0the\u00a0tokens and decrypt the content\u00a0in the\u00a0notification payload.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Rich notifications provide\u00a0encrypted\u00a0changed data\u00a0along\u00a0with the change notifications, saving the subscriber from having to call back Microsoft Graph\u00a0to fetch the data,\u00a0thereby\u00a0improving application performance. You can read more about this feature in the\u00a0<\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/webhooks-with-resource-data\"><span data-contrast=\"none\">documentation<\/span><\/a><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h4><span data-contrast=\"none\">Improved testability of<\/span><i><span data-contrast=\"none\">\u00a0<\/span><\/i><b><span data-contrast=\"none\">GraphServiceClient<\/span><\/b><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:240,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">The\u00a0<\/span><b><span data-contrast=\"auto\">IGraphServiceClient<\/span><\/b><span data-contrast=\"auto\">\u00a0interface has been used by\u00a0Microsoft Graph .NET SDK users\u00a0to build application tests that depend on\u00a0<\/span><b><span data-contrast=\"auto\">GraphServiceClient<\/span><\/b><span data-contrast=\"auto\">. Using this interface, however,\u00a0causes\u00a0code breaks whenever the Microsoft Graph metadata changes,\u00a0making it less than ideal for mocking or inheriting.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">To improve users&#8217; experience, the interface has been removed in Microsoft Graph .NET SDK v4. Properties and methods of\u00a0<\/span><b><span data-contrast=\"auto\">GraphServiceClient<\/span><\/b><span data-contrast=\"auto\">\u00a0have been made virtual, allowing mocking frameworks to\u00a0override them.\u00a0Users do not have to create real objects\u00a0to test the application.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h4><b><span data-contrast=\"none\">ODataType<\/span><\/b><span data-contrast=\"none\">\u00a0is no longer\u00a0specified by default<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:240,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">Since\u00a0the release of\u00a0Microsoft Graph .NET SDK v3, generated types\u00a0have\u00a0had\u00a0the\u00a0<\/span><b><span data-contrast=\"auto\">ODataType<\/span><\/b><span data-contrast=\"auto\">\u00a0property\u00a0set\u00a0by\u00a0default in\u00a0the SDK.\u00a0Even though this was not a problem\u00a0at\u00a0the\u00a0time,\u00a0Microsoft Graph\u00a0has\u00a0continued\u00a0to grow\u00a0and\u00a0more\u00a0APIs\u00a0have been\u00a0onboarded,\u00a0the\u00a0<\/span><b><span data-contrast=\"auto\">ODataType<\/span><\/b><span data-contrast=\"auto\">\u00a0property\u00a0has\u00a0started to\u00a0cause\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-beta-sdk-dotnet\/issues\/226\"><span data-contrast=\"none\">errors<\/span><\/a><span data-contrast=\"auto\">\u00a0during\u00a0its\u00a0serialization\u00a0to some of the APIs.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">In v4, the\u00a0<\/span><b><span data-contrast=\"auto\">ODataType<\/span><\/b><span data-contrast=\"auto\">\u00a0property\u00a0is\u00a0only\u00a0set\u00a0in cases where type disambiguation is\u00a0required,\u00a0for example:<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">When\u00a0the type is derived\u00a0from an abstract type.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">When one of its base types is referenced as the type for a property\u00a0on\u00a0another type,\u00a0unless\u00a0the base is\u00a0an\u00a0entity,\u00a0e.g.,\u00a0<\/span><b><span data-contrast=\"auto\">OrganizerMeetingInfo<\/span><\/b><span data-contrast=\"auto\">\u00a0has its base type\u00a0<\/span><b><span data-contrast=\"auto\">MeetingInfo<\/span><\/b><span data-contrast=\"auto\">\u00a0referenced\u00a0as the type of a property on another type.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">When one of its base types is\u00a0referenced as\u00a0a\u00a0type in an\u00a0OData action\u00a0of\u00a0another type,\u00a0unless\u00a0the base\u00a0type\u00a0is entity,\u00a0e.g.,\u00a0<\/span><b><span data-contrast=\"auto\">AppHostedMediaConfig<\/span><\/b><span data-contrast=\"auto\">\u00a0has its base type\u00a0<\/span><b><span data-contrast=\"auto\">MediaConfig<\/span><\/b><span data-contrast=\"auto\">\u00a0referenced in an action.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<h4><span data-contrast=\"none\">Get started with\u00a0Microsoft Graph .NET SDK\u00a0v4<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:240,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">To get familiar with the Microsoft Graph SDKs,\u00a0start\u00a0with the\u00a0<\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/sdks\/sdks-overview\"><span data-contrast=\"none\">documentation page<\/span><\/a><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-sdk-dotnet\/issues\/935\"><span data-contrast=\"none\">upgrade guide<\/span><\/a><span data-contrast=\"auto\">\u00a0will guide you through\u00a0the\u00a0migration and provide examples\u00a0for\u00a0implementing\u00a0the new features,\u00a0helping you quickly take\u00a0advantage of all the new capabilities.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/sdks\/sdk-installation#install-the-microsoft-graph-net-sdk\"><span data-contrast=\"none\">Start saving time and\u00a0removing complexity in your code today<\/span><\/a><span data-contrast=\"auto\">.\u00a0Whether you prefer a barebone client or a fluent API,\u00a0you can choose between the\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-sdk-dotnet-core\"><span data-contrast=\"none\">Microsoft Graph .NET SDK Core<\/span><\/a><span data-contrast=\"auto\">\u00a0or\u00a0the\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-sdk-dotnet\"><span data-contrast=\"none\">Microsoft Graph .NET SDK Client<\/span><\/a><span data-contrast=\"auto\">, whichever\u00a0best suits\u00a0your\u00a0needs.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Sign up for\u00a0the\u00a0<\/span><a href=\"https:\/\/developer.microsoft.com\/en-us\/microsoft-365\/dev-program\"><span data-contrast=\"none\">Microsoft 365 Developer Program<\/span><\/a><span data-contrast=\"auto\">\u00a0to get a free Microsoft 365 developer subscription,\u00a0and\u00a0start\u00a0<\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/tutorials\/dotnet-core\"><span data-contrast=\"none\">building .NET Core apps with Microsoft Graph<\/span><\/a><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h4><span data-contrast=\"none\">Thank you!<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:240,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"auto\">We\u2019d like to thank all the members of the community who have helped us make this release better by reporting issues\u00a0in\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-sdk-dotnet\"><span data-contrast=\"none\">GitHub<\/span><\/a><span data-contrast=\"auto\">!<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Here are some of the\u00a0feedback we would like to\u00a0highlight:<\/span>\n<a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-sdk-dotnet\/issues\/935%23issuecomment-851528409\"><span data-contrast=\"none\">Andreas Jakof<\/span><\/a><span data-contrast=\"auto\">,\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-beta-sdk-dotnet\/issues\/262\"><span data-contrast=\"none\">Sudheer Achary<\/span><\/a><span data-contrast=\"auto\">,\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-sdk-dotnet\/issues\/916\"><span data-contrast=\"none\">Nate Latchaw<\/span><\/a><span data-contrast=\"auto\">,\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-beta-sdk-dotnet\/issues\/275\"><span data-contrast=\"none\">schmid37<\/span><\/a><span data-contrast=\"auto\">,\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-beta-sdk-dotnet\/issues\/291\"><span data-contrast=\"none\">Danial Mazahreh<\/span><\/a><span data-contrast=\"auto\">,\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-sdk-dotnet\/issues\/956\"><span data-contrast=\"none\">pbaumhart<\/span><\/a><span data-contrast=\"auto\">,\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-sdk-dotnet\/issues\/909\"><span data-contrast=\"none\">Dean\u00a0Kinane<\/span><\/a><span data-contrast=\"auto\">,<\/span><span data-contrast=\"auto\">\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-beta-sdk-dotnet\/issues\/283\"><span data-contrast=\"none\">Cory\u00a0Grimster<\/span><\/a><span data-contrast=\"auto\">,\u00a0and\u00a0<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-beta-sdk-dotnet\/issues\/226\"><span data-contrast=\"none\">Michael Hawker<\/span><\/a><span data-contrast=\"auto\">.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Keep them coming!<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h4><span data-contrast=\"none\">Try out the new version today!<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:240,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h4>\n<p><span data-contrast=\"none\">Try out this new version and let us know what you think\u202f<\/span><a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-sdk-dotnet\/issues\/new\"><span data-contrast=\"none\">on GitHub!<\/span><\/a><span data-contrast=\"none\">\u202fAsk questions at\u202f<\/span><a href=\"https:\/\/docs.microsoft.com\/en-us\/answers\/topics\/microsoft-graph-sdk.html\"><span data-contrast=\"none\">Microsoft Q&amp;A<\/span><\/a><span data-contrast=\"none\">.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;134233117&quot;:true,&quot;134233118&quot;:true,&quot;201341983&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><span data-contrast=\"none\">Happy coding!<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>New features and improvements simplify building high-quality, efficient and resilient applications accessing Microsoft Graph.<\/p>\n","protected":false},"author":69077,"featured_media":25159,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[151],"class_list":["post-6565","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-graph","tag-microsoft-graph-net-sdk"],"acf":[],"blog_post_summary":"<p>New features and improvements simplify building high-quality, efficient and resilient applications accessing Microsoft Graph.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/6565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69077"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=6565"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/6565\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/25159"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=6565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=6565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=6565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}