Skip to content

Commit 32763e1

Browse files
committed
2 parents 4cad6fc + ecd1f5f commit 32763e1

File tree

17 files changed

+54
-158
lines changed

17 files changed

+54
-158
lines changed

1-Call-MSGraph/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ For more information on the concepts used in this sample, be sure to read the [M
4747

4848
To run this sample, you'll need:
4949

50-
- [Visual Studio 2017](https://aka.ms/vsdownload) or just the [.NET Core SDK](https://www.microsoft.com/net/learn/get-started)
50+
- [Visual Studio 2017](https://aka.ms/vsdownload) or newer, or just the [.NET Core SDK](https://www.microsoft.com/net/learn/get-started)
5151
- An Internet connection
5252
- A Windows machine (necessary if you want to run the app on Windows)
5353
- An OS X machine (necessary if you want to run the app on Mac)
@@ -158,6 +158,8 @@ Clean the solution, rebuild the solution, and run it.
158158

159159
Start the application, it will display the users in the tenant.
160160

161+
> [Consider taking a moment to share your experience with us.](https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbRy8G199fkJNDjJ9kJaxUJIhUNUJGSDU1UkxFMlRSWUxGVTlFVkpGT0tOTi4u)
162+
161163
## About the code
162164

163165
The relevant code for this sample is in the `Program.cs` file, in the `RunAsync()` method. The steps are:

1-Call-MSGraph/daemon-console/AuthenticationConfig.cs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
1-
/*
2-
The MIT License (MIT)
3-
4-
Copyright (c) 2015 Microsoft Corporation
5-
6-
Permission is hereby granted, free of charge, to any person obtaining a copy
7-
of this software and associated documentation files (the "Software"), to deal
8-
in the Software without restriction, including without limitation the rights
9-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
copies of the Software, and to permit persons to whom the Software is
11-
furnished to do so, subject to the following conditions:
12-
13-
The above copyright notice and this permission notice shall be included in all
14-
copies or substantial portions of the Software.
15-
16-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22-
SOFTWARE.
23-
*/
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
243

254
using Microsoft.Extensions.Configuration;
265
using System;

1-Call-MSGraph/daemon-console/Program.cs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
1-
/*
2-
The MIT License (MIT)
3-
4-
Copyright (c) 2015 Microsoft Corporation
5-
6-
Permission is hereby granted, free of charge, to any person obtaining a copy
7-
of this software and associated documentation files (the "Software"), to deal
8-
in the Software without restriction, including without limitation the rights
9-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
copies of the Software, and to permit persons to whom the Software is
11-
furnished to do so, subject to the following conditions:
12-
13-
The above copyright notice and this permission notice shall be included in all
14-
copies or substantial portions of the Software.
15-
16-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22-
SOFTWARE.
23-
*/
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
244
using Microsoft.Identity.Client;
255
using Newtonsoft.Json.Linq;
266
using System;

1-Call-MSGraph/daemon-console/ProtectedApiCallHelper.cs

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
1-
/*
2-
The MIT License (MIT)
3-
4-
Copyright (c) 2015 Microsoft Corporation
5-
6-
Permission is hereby granted, free of charge, to any person obtaining a copy
7-
of this software and associated documentation files (the "Software"), to deal
8-
in the Software without restriction, including without limitation the rights
9-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
copies of the Software, and to permit persons to whom the Software is
11-
furnished to do so, subject to the following conditions:
12-
13-
The above copyright notice and this permission notice shall be included in all
14-
copies or substantial portions of the Software.
15-
16-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22-
SOFTWARE.
23-
*/
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
243

254
using Newtonsoft.Json;
265
using Newtonsoft.Json.Linq;
@@ -50,11 +29,11 @@ public ProtectedApiCallHelper(HttpClient httpClient)
5029

5130

5231
/// <summary>
53-
/// Calls the protected Web API and processes the result
32+
/// Calls the protected web API and processes the result
5433
/// </summary>
55-
/// <param name="webApiUrl">Url of the Web API to call (supposed to return Json)</param>
56-
/// <param name="accessToken">Access token used as a bearer security token to call the Web API</param>
57-
/// <param name="processResult">Callback used to process the result of the call to the Web API</param>
34+
/// <param name="webApiUrl">URL of the web API to call (supposed to return Json)</param>
35+
/// <param name="accessToken">Access token used as a bearer security token to call the web API</param>
36+
/// <param name="processResult">Callback used to process the result of the call to the web API</param>
5837
public async Task CallWebApiAndProcessResultASync(string webApiUrl, string accessToken, Action<JObject> processResult)
5938
{
6039
if (!string.IsNullOrEmpty(accessToken))
@@ -64,7 +43,7 @@ public async Task CallWebApiAndProcessResultASync(string webApiUrl, string acces
6443
{
6544
HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
6645
}
67-
defaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", accessToken);
46+
defaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
6847

6948
HttpResponseMessage response = await HttpClient.GetAsync(webApiUrl);
7049
if (response.IsSuccessStatusCode)
@@ -77,7 +56,7 @@ public async Task CallWebApiAndProcessResultASync(string webApiUrl, string acces
7756
else
7857
{
7958
Console.ForegroundColor = ConsoleColor.Red;
80-
Console.WriteLine($"Failed to call the Web Api: {response.StatusCode}");
59+
Console.WriteLine($"Failed to call the web API: {response.StatusCode}");
8160
string content = await response.Content.ReadAsStringAsync();
8261

8362
// Note that if you got reponse.Code == 403 and reponse.content.code == "Authorization_RequestDenied"

1-Call-MSGraph/daemon-console/daemon-console.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.0" />
1515
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="3.1.0" />
1616
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.0" />
17-
<PackageReference Include="Microsoft.Identity.Client" Version="4.18.0" />
17+
<PackageReference Include="Microsoft.Identity.Client" Version="4.24.0" />
1818
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
1919
</ItemGroup>
2020

2-Call-OwnApi/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ Clean the solution, rebuild the solution, and run it. You might want to go into
201201

202202
Start the application, it will display the users in the tenant.
203203

204+
> [Consider taking a moment to share your experience with us.](https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbRy8G199fkJNDjJ9kJaxUJIhUNUJGSDU1UkxFMlRSWUxGVTlFVkpGT0tOTi4u)
205+
204206
## About the code
205207

206208
The relevant code for this sample is in the `Program.cs` file, in the `RunAsync()` method. The steps are:

2-Call-OwnApi/TodoList-WebApi/Controllers/TodoListController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using System;
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using System;
25
using System.Collections.Generic;
36
using System.Linq;
47
using System.Threading.Tasks;

2-Call-OwnApi/TodoList-WebApi/Models/TodoItem.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
namespace TodoList_WebApi.Models
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
namespace TodoList_WebApi.Models
25
{
36
public class TodoItem
47
{

2-Call-OwnApi/TodoList-WebApi/Program.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using Microsoft.AspNetCore.Hosting;
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.AspNetCore.Hosting;
25
using Microsoft.Extensions.Hosting;
36

47
namespace TodoList_WebApi

2-Call-OwnApi/TodoList-WebApi/Startup.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using Microsoft.AspNetCore.Authentication.JwtBearer;
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.AspNetCore.Authentication.JwtBearer;
25
using Microsoft.AspNetCore.Builder;
36
using Microsoft.AspNetCore.Hosting;
47
using Microsoft.Extensions.Configuration;

0 commit comments

Comments
 (0)