In this blog post, I will show you how to use the GraphClient in a VB.Net application. You will need to create an app registration for this project. I used the exact same app registration that I used in my previous VB.Net blog post here.

SDK Reference: https://docs.microsoft.com/en-us/graph/sdks/sdks-overview?view=graph-rest-1.0

I am using Visual Studio 2019 in this example. To begin, please start a VB.Net Console application and then install the following nuget packages:

Install nuget packages:

This will also install

  • Microsoft.Graph.Core
  • Microsoft.Json
  • System.Buffers
  • System.Diagnostics.DiagnosticSource
  • System.Numerics.Vectors
  • System.Runtime.CompilerServices.Unsafe
  • System.ValueTuple

I will be creating a custom Authentication Provider for this project. The reference for this:

Creating an Authentication Provider Reference: https://docs.microsoft.com/en-us/graph/sdks/choose-authentication-providers?tabs=CS

I am creating a custom authentication provider class called “InteractiveAuthentionProvider.vb”

There is a preview component you can install that has these classes built in so that you don’t have to implement your own class:  https://github.com/microsoftgraph/msgraph-sdk-dotnet-auth  That is currently in preview mode so I will blog about this later.

I have the custom InteractiveAuthenticationProvider class that will be passed to GraphClient.  In Module1, you will need to enter your client ID and tenant ID.  Refer to my previous blog post here about setting up the app registration.

 

In summary, this example of using the GraphClient library in a VB.Net application demonstrates that, although different than the c# examples we have in our docs, there really isn’t much to using the different language.

Leave a Reply

avatar
  Subscribe  
Notify of