Skip to content

Commit ee711f3

Browse files
authored
[Sample][Proxy Provider] Updated Dependencies in ProxyProvider samples (#1300)
1 parent 51c8167 commit ee711f3

File tree

13 files changed

+738
-89
lines changed

13 files changed

+738
-89
lines changed

samples/proxy-provider-asp-net-core/Controllers/ProxyController.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,38 @@ public ProxyController(IWebHostEnvironment hostingEnvironment, IGraphServiceClie
3333
[Route("{*all}")]
3434
public async Task<IActionResult> GetAsync(string all)
3535
{
36-
return await ProcessRequestAsync("GET", all, null).ConfigureAwait(false);
36+
return await ProcessRequestAsync(Microsoft.Graph.HttpMethods.GET, all, null).ConfigureAwait(false);
3737
}
3838

3939
[HttpPost]
4040
[Route("{*all}")]
4141
public async Task<IActionResult> PostAsync(string all, [FromBody] object body)
4242
{
43-
return await ProcessRequestAsync("POST", all, body).ConfigureAwait(false);
43+
return await ProcessRequestAsync(Microsoft.Graph.HttpMethods.POST, all, body).ConfigureAwait(false);
4444
}
4545

4646
[HttpDelete]
4747
[Route("{*all}")]
4848
public async Task<IActionResult> DeleteAsync(string all)
4949
{
50-
return await ProcessRequestAsync("DELETE", all, null).ConfigureAwait(false);
50+
return await ProcessRequestAsync(Microsoft.Graph.HttpMethods.DELETE, all, null).ConfigureAwait(false);
5151
}
5252

5353
[HttpPut]
5454
[Route("{*all}")]
5555
public async Task<IActionResult> PutAsync(string all, [FromBody] object body)
5656
{
57-
return await ProcessRequestAsync("PUT", all, body).ConfigureAwait(false);
57+
return await ProcessRequestAsync(Microsoft.Graph.HttpMethods.PUT, all, body).ConfigureAwait(false);
5858
}
5959

6060
[HttpPatch]
6161
[Route("{*all}")]
6262
public async Task<IActionResult> PatchAsync(string all, [FromBody] object body)
6363
{
64-
return await ProcessRequestAsync("PATCH", all, body).ConfigureAwait(false);
64+
return await ProcessRequestAsync(Microsoft.Graph.HttpMethods.PATCH, all, body).ConfigureAwait(false);
6565
}
6666

67-
private async Task<IActionResult> ProcessRequestAsync(string method, string all, object content)
67+
private async Task<IActionResult> ProcessRequestAsync(Microsoft.Graph.HttpMethods method, string all, object content)
6868
{
6969
var graphClient = _graphServiceClientFactory.GetAuthenticatedGraphClient((ClaimsIdentity)User.Identity);
7070

samples/proxy-provider-asp-net-core/Views/Home/Index.cshtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
1+
<!-- Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
22
See LICENSE in the source repository root for complete license information. -->
33

44
@{
@@ -14,5 +14,5 @@
1414
}
1515
@if (User.Identity.IsAuthenticated)
1616
{
17-
<mgt-person person-details="@ViewData["Response"]" person-image="@ViewData["Picture"]" show-presence view="twoLines" person-card="hover"></mgt-person>
18-
}
17+
<mgt-people></mgt-people>
18+
}

samples/proxy-provider-asp-net-core/mgt-netcore.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="3.1.5" />
12-
<PackageReference Include="Microsoft.Graph" Version="3.8.0" />
13-
<PackageReference Include="Microsoft.Identity.Client" Version="4.16.1" />
12+
<PackageReference Include="Microsoft.Graph" Version="4.3.0" />
13+
<PackageReference Include="Microsoft.Identity.Client" Version="4.35.1" />
1414
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
1515
</ItemGroup>
1616

samples/proxy-provider-asp-net-mvc/graph-tutorial/Controllers/GraphProxyController.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using graph_tutorial.Helpers;
1+
using graph_tutorial.Helpers;
22
using Microsoft.Graph;
33
using System;
44
using System.Collections;
@@ -22,38 +22,38 @@ public class GraphProxyController : ApiController
2222
[Route("{*all}")]
2323
public async Task<HttpResponseMessage> GetAsync(string all)
2424
{
25-
return await ProcessRequestAsync("GET", all, null).ConfigureAwait(false);
25+
return await ProcessRequestAsync(HttpMethods.GET, all, null).ConfigureAwait(false);
2626
}
2727

2828
[HttpPost]
2929
[Route("{*all}")]
3030
public async Task<HttpResponseMessage> PostAsync(string all, [FromBody]object body)
3131
{
32-
return await ProcessRequestAsync("POST", all, body).ConfigureAwait(false);
32+
return await ProcessRequestAsync(HttpMethods.POST, all, body).ConfigureAwait(false);
3333
}
3434

3535
[HttpDelete]
3636
[Route("{*all}")]
3737
public async Task<HttpResponseMessage> DeleteAsync(string all)
3838
{
39-
return await ProcessRequestAsync("DELETE", all, null).ConfigureAwait(false);
39+
return await ProcessRequestAsync(HttpMethods.DELETE, all, null).ConfigureAwait(false);
4040
}
4141

4242
[HttpPut]
4343
[Route("{*all}")]
4444
public async Task<HttpResponseMessage> PutAsync(string all, [FromBody]object body)
4545
{
46-
return await ProcessRequestAsync("PUT", all, body).ConfigureAwait(false);
46+
return await ProcessRequestAsync(HttpMethods.PUT, all, body).ConfigureAwait(false);
4747
}
4848

4949
[HttpPatch]
5050
[Route("{*all}")]
5151
public async Task<HttpResponseMessage> PatchAsync(string all, [FromBody]object body)
5252
{
53-
return await ProcessRequestAsync("PATCH", all, body).ConfigureAwait(false);
53+
return await ProcessRequestAsync(HttpMethods.PATCH, all, body).ConfigureAwait(false);
5454
}
5555

56-
private async Task<HttpResponseMessage> ProcessRequestAsync(string method, string all, object content)
56+
private async Task<HttpResponseMessage> ProcessRequestAsync(HttpMethods method, string all, object content)
5757
{
5858
var graphClient = GraphHelper.GetAuthenticatedClient();
5959

@@ -77,7 +77,7 @@ private async Task<HttpResponseMessage> ProcessRequestAsync(string method, strin
7777

7878
try
7979
{
80-
using (var response = await request.SendRequestAsync(content, CancellationToken.None, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false))
80+
using (var response = await request.SendRequestAsync(content?.ToString(), CancellationToken.None, HttpCompletionOption.ResponseContentRead).ConfigureAwait(false))
8181
{
8282
response.Content.Headers.TryGetValues("content-type", out var contentTypes);
8383

0 commit comments

Comments
 (0)