6
6
using Microsoft . Extensions . Configuration ;
7
7
using Microsoft . Extensions . Logging ;
8
8
using Microsoft . Graph ;
9
+ using Microsoft . Graph . Models ;
9
10
using Microsoft . Identity . Client ;
10
11
using Microsoft . Identity . Web ;
11
12
using System ;
@@ -25,7 +26,7 @@ public class HomeController : Controller
25
26
26
27
private readonly MicrosoftIdentityConsentAndConditionalAccessHandler _consentHandler ;
27
28
28
- private string [ ] _graphScopes ;
29
+ private readonly string [ ] _graphScopes ;
29
30
30
31
public HomeController ( ILogger < HomeController > logger ,
31
32
IConfiguration configuration ,
@@ -34,7 +35,7 @@ public HomeController(ILogger<HomeController> logger,
34
35
{
35
36
_logger = logger ;
36
37
_graphServiceClient = graphServiceClient ;
37
- this . _consentHandler = consentHandler ;
38
+ _consentHandler = consentHandler ;
38
39
39
40
// Capture the Scopes for Graph that were used in the original request for an Access token (AT) for MS Graph as
40
41
// they'd be needed again when requesting a fresh AT for Graph during claims challenge processing
@@ -54,7 +55,7 @@ public async Task<IActionResult> Profile()
54
55
55
56
try
56
57
{
57
- currentUser = await _graphServiceClient . Me . Request ( ) . GetAsync ( ) ;
58
+ currentUser = await _graphServiceClient . Me . GetAsync ( ) ;
58
59
}
59
60
// Catch CAE exception from Graph SDK
60
61
catch ( ServiceException svcex ) when ( svcex . Message . Contains ( "Continuous access evaluation resulted in claims challenge" ) )
@@ -75,7 +76,7 @@ public async Task<IActionResult> Profile()
75
76
try
76
77
{
77
78
// Get user photo
78
- using ( var photoStream = await _graphServiceClient . Me . Photo . Content . Request ( ) . GetAsync ( ) )
79
+ using ( var photoStream = await _graphServiceClient . Me . Photo . Content . GetAsync ( ) )
79
80
{
80
81
byte [ ] photoByte = ( ( MemoryStream ) photoStream ) . ToArray ( ) ;
81
82
ViewData [ "Photo" ] = Convert . ToBase64String ( photoByte ) ;
0 commit comments