I need a full sample to use GraphClient with dotNet, this documentation (How to use GraphClient for Microsoft Graph|Documentation) is not complete and it’s not updated.
Public Class AccessParameters_APP
Public Property TenantId As String
Public Property ClientId As String
Public Property ClientSecret As String
Public Property Scopes As String() = {“Sign in to Outlook”}
End Class
Public Class siscAccessToken365
Public Shared Async Function GetAccessToken_APP(ByVal accessParameters As Locale.AsposeComponent.AccessParameters_APP) As System.Threading.Tasks.Task(Of String)
Try
Dim cca = Microsoft.Identity.Client.ConfidentialClientApplicationBuilder.Create(accessParameters.ClientId).WithClientSecret(accessParameters.ClientSecret).WithTenantId(accessParameters.TenantId).Build()
Dim result = Await cca.AcquireTokenForClient(accessParameters.Scopes).ExecuteAsync()
Locale.AsposeComponent.AsposeManager.resTokenAuth = result
Return result.AccessToken
Catch ex As Exception
End Try
End Function
End Class
’ LOGIN LIKE APP - SECRET Code
Dim mieiParam As New AccessParameters_APP
mieiParam.ClientId = “…”
mieiParam.ClientSecret = “…”
mieiParam.TenantId = “…”
Dim myScopes As String()
ReDim myScopes(0)
myScopes(0) = “Sign in to Outlook”
mieiParam.Scopes = myScopes
Call siscAccessToken365.GetAccessToken_APP(mieiParam)
Do
Application.DoEvents()
System.Threading.Thread.Sleep(100)
If IsNothing(resTokenAuth) Then
' wait
Else
If Trim(resTokenAuth.AccessToken) <> "" Then Exit Do
End If
Loop
I have token, but now?
Dim clientApp As Aspose.Email.Clients.Graph.IGraphClient = Aspose.Email.Clients.Graph.GraphClient.GetClient( ??