Skip to content

Commit f289438

Browse files
author
Andrew Omondi
committed
Merge branch 'pr_feedbac_changes' into use-graph-sdk-and-update-msal
2 parents be1fb06 + 5588a87 commit f289438

18 files changed

Lines changed: 357 additions & 275 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,6 @@ pip-log.txt
214214

215215
#Mr Developer
216216
.mr.developer.cfg
217+
218+
#Appsettings.json file
219+
ConsoleApplication/appsettings.json

ConsoleApplication/ApplicationConfig.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
The MIT License (MIT)
33
4-
Copyright (c) 2015 Microsoft Corporation
4+
Copyright (c) 2019 Microsoft Corporation
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal
@@ -53,11 +53,6 @@ public class AppConfiguration
5353
/// </summary>
5454
public string ClientId { get; set; }
5555

56-
/// <summary>
57-
/// Scopes needed by the application to work
58-
/// </summary>
59-
public string [] Scopes { get; set; }
60-
6156
/// <summary>
6257
/// URL of the authority
6358
/// </summary>

ConsoleApplication/ChangeManager.cs

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
//-------------------------------------------------------------------------------------------------
2-
// <copyright file="ChangeManager.cs" company="Microsoft">
3-
// Copyright (c) Microsoft Corporation. All rights reserved.
4-
// </copyright>
5-
//
6-
// <summary>
7-
// Delta Query sample application.
8-
//
9-
// This source is subject to the Sample Client End User License Agreement
10-
// included in this project.
11-
// </summary>
12-
//
13-
// <remarks />
14-
//
15-
// <disclaimer>
16-
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
17-
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
18-
// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
19-
// </disclaimer>
20-
//-------------------------------------------------------------------------------------------------
1+
/*
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2019 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+
*/
2124

2225
namespace DeltaQueryApplication
2326
{

ConsoleApplication/ChangeObjectHandler.cs

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
//-------------------------------------------------------------------------------------------------
2-
// <copyright file="ChangeObjectHandler.cs" company="Microsoft">
3-
// Copyright (c) Microsoft Corporation. All rights reserved.
4-
// </copyright>
5-
//
6-
// <summary>
7-
// Delta Query sample application.
8-
//
9-
// This source is subject to the Sample Client End User License Agreement
10-
// included in this project.
11-
// </summary>
12-
//
13-
// <remarks />
14-
//
15-
// <disclaimer>
16-
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
17-
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
18-
// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
19-
// </disclaimer>
20-
//-------------------------------------------------------------------------------------------------
1+
/*
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2019 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+
*/
2124

2225
namespace DeltaQueryApplication
2326
{

ConsoleApplication/Constants.cs

Lines changed: 25 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
//-------------------------------------------------------------------------------------------------
2-
// <copyright file="Constants.cs" company="Microsoft">
3-
// Copyright (c) Microsoft Corporation. All rights reserved.
4-
// </copyright>
5-
//
6-
// <summary>
7-
// Delta Query sample client.
8-
//
9-
// This source is subject to the Sample Client End User License Agreement
10-
// included in this project.
11-
// </summary>
12-
//
13-
// <remarks />
14-
//
15-
// <disclaimer>
16-
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
17-
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
18-
// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
19-
// </disclaimer>
20-
//-------------------------------------------------------------------------------------------------
1+
/*
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2019 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+
*/
2124

2225
namespace DeltaQueryApplication
2326
{
@@ -26,20 +29,6 @@ namespace DeltaQueryApplication
2629
/// </summary>
2730
internal static class Constants
2831
{
29-
/// <summary>
30-
/// Authorization header.
31-
/// </summary>
32-
public const string HeaderNameAuthorization = "Authorization";
33-
34-
/// <summary>
35-
/// deltaLink query parameter.
36-
/// </summary>
37-
public const string DeltaLinkQueryParameter = "deltatoken";
38-
39-
/// <summary>
40-
/// nextLink query parameter.
41-
/// </summary>
42-
public const string NextLinkQueryParameter = "skiptoken";
4332

4433
/// <summary>
4534
/// Feed annotation that represents a URI to be called immediately for more changes.
@@ -52,8 +41,8 @@ internal static class Constants
5241
public const string NextLinkFeedAnnotation = "@odata.nextLink";
5342

5443
/// <summary>
55-
/// Format for getting STS endpoint.
44+
/// String url for the default scope in MS Graph
5645
/// </summary>
57-
public const string AuthEndpoint = "https://login.windows.net/{0}";
46+
public const string DefaultScope = "https://graph.microsoft.com/.default";
5847
}
5948
}

ConsoleApplication/DeltaQuery.cs

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
// <copyright file="DeltaQuery.cs" company="Microsoft">
2-
// Copyright (c) Microsoft Corporation. All rights reserved.
3-
// </copyright>
4-
//
5-
// <summary>
6-
// Delta Query sample client.
7-
//
8-
// This source is subject to the Sample Client End User License Agreement
9-
// included in this project.
10-
// </summary>
11-
//
12-
// <remarks />
13-
//
14-
// <disclaimer>
15-
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
16-
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
17-
// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
18-
// </disclaimer>
19-
//-------------------------------------------------------------------------------------------------
1+
/*
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2019 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+
*/
2024

2125
using Microsoft.Graph;
2226
using Microsoft.Identity.Client;
@@ -53,7 +57,7 @@ public DeltaQuery(
5357
GraphClientFactory.GetGraphServiceClient(
5458
appConfiguration.ClientId,
5559
appConfiguration.Authority,
56-
appConfiguration.Scopes);
60+
new string [] { Constants.DefaultScope });
5761
}
5862

5963
/// <summary>

ConsoleApplication/DeltaQueryResult.cs

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
//-------------------------------------------------------------------------------------------------
2-
// <copyright file="DeltaQueryResult.cs" company="Microsoft">
3-
// Copyright (c) Microsoft Corporation. All rights reserved.
4-
// </copyright>
5-
//
6-
// <summary>
7-
// Delta Query sample client.
8-
//
9-
// This source is subject to the Sample Client End User License Agreement
10-
// included in this project.
11-
// </summary>
12-
//
13-
// <remarks />
14-
//
15-
// <disclaimer>
16-
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
17-
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
18-
// WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
19-
// </disclaimer>
20-
//-------------------------------------------------------------------------------------------------
1+
/*
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2019 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+
*/
2124

2225
namespace DeltaQueryApplication
2326
{

ConsoleApplication/Helpers/GraphClientFactory.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1-
using Microsoft.Graph;
1+
/*
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2019 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+
*/
24+
25+
using Microsoft.Graph;
226
using Microsoft.Identity.Client;
327
using System;
428
using System.Collections.Generic;
@@ -10,12 +34,24 @@ namespace DeltaQueryApplication
1034
{
1135
public static class GraphClientFactory
1236
{
37+
/// <summary>
38+
/// Helper to generate an instance of a usable Graphclient class
39+
/// <param name="clientId">Client id for the application needing to make graph calls</param>
40+
/// <param name="authority">Url to provide authority for the tenant</param>
41+
/// <param name="scopes">Scopes to be used by the application </param>
42+
/// </summary>
1343
public static GraphServiceClient GetGraphServiceClient(string clientId, string authority, string[] scopes)
1444
{
1545
var authenticationProvider = CreateAuthorizationProvider(clientId, authority, scopes);
1646
return new GraphServiceClient(authenticationProvider);
1747
}
1848

49+
/// <summary>
50+
/// Helper to generate an instance of a IAuthenticationProvider
51+
/// <param name="clientId">Client id for the application needing to make graph calls</param>
52+
/// <param name="authority">Url to provide authority for the tenant</param>
53+
/// <param name="scopes">Scopes to be used by the application </param>
54+
/// </summary>
1955
private static IAuthenticationProvider CreateAuthorizationProvider(string clientId, string authority, string[] scopes)
2056
{
2157
var clientApplication = new PublicClientApplication(clientId, authority);

0 commit comments

Comments
 (0)