Skip to content

Commit

Permalink
Update samples
Browse files Browse the repository at this point in the history
  • Loading branch information
pschaeflein committed Oct 18, 2023
1 parent 1074bed commit 7fd5b6a
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 721 deletions.
6 changes: 0 additions & 6 deletions Graph.Community.lutconfig

This file was deleted.

82 changes: 0 additions & 82 deletions samples/ApplicationPermissions.cs

This file was deleted.

55 changes: 23 additions & 32 deletions samples/ChangeLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,47 +59,38 @@ public async Task Run()
// Setup is complete, run the sample
//
///////////////////////////////////////
try
{


var scopes = new string[] { $"https://{sharePointSettings.Hostname}/AllSites.FullControl" };
var WebUrl = $"https://{sharePointSettings.Hostname}{sharePointSettings.SiteCollectionUrl}";

var web = await graphServiceClient
.SharePointAPI(WebUrl)
.Web
.Request()
.WithScopes(scopes)
.GetAsync();
var scopes = new string[] { $"https://{sharePointSettings.Hostname}/AllSites.FullControl" };
var WebUrl = $"https://{sharePointSettings.Hostname}{sharePointSettings.SiteCollectionUrl}";

var changeToken = web.CurrentChangeToken;
Console.WriteLine($"current change token: {changeToken.StringValue}");
var web = await graphServiceClient
.SharePointAPI(WebUrl)
.Web
.Request()
.WithScopes(scopes)
.GetAsync();

Console.WriteLine($"Make an update to the site {WebUrl}");
Console.WriteLine("Press enter to continue");
Console.ReadLine();
var changeToken = web.CurrentChangeToken;
Console.WriteLine($"current change token: {changeToken.StringValue}");

var qry = new ChangeQuery(true, true);
qry.ChangeTokenStart = changeToken;
Console.WriteLine($"Make an update to the site {WebUrl}");
Console.WriteLine("Press enter to continue");
Console.ReadLine();

var changes = await graphServiceClient
.SharePointAPI(WebUrl)
.Web
.Request()
.GetChangesAsync(qry);
var qry = new ChangeQuery(true, true);
qry.ChangeTokenStart = changeToken;

Console.WriteLine(changes.Count);
var changes = await graphServiceClient
.SharePointAPI(WebUrl)
.Web
.Request()
.GetChangesAsync(qry);

foreach (var item in changes)
{
Console.WriteLine($"{item.ChangeType}");
}
Console.WriteLine(changes.Count);

}
catch (Exception ex)
foreach (var item in changes)
{
Console.WriteLine(ex.Message);
Console.WriteLine($"{item.ChangeType}");
}

Console.WriteLine("Press enter to show log");
Expand Down
6 changes: 0 additions & 6 deletions samples/Graph.Community.Samples.lutconfig

This file was deleted.

105 changes: 0 additions & 105 deletions samples/ListFields.cs

This file was deleted.

10 changes: 4 additions & 6 deletions samples/MenuService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ private async ValueTask MenuAsync()
Console.WriteLine("5. Site Pages");
Console.WriteLine("6. SharePoint Search");
Console.WriteLine("7. Site Design");
Console.WriteLine("8. Site");
Console.WriteLine("9. Application Permissions");
Console.WriteLine("8. Group extensions (Graph)");
//Console.WriteLine("9. ");
Console.WriteLine("");
Console.WriteLine("");
Console.WriteLine("Ctrl+C to Exit");
Expand Down Expand Up @@ -104,14 +104,12 @@ private async ValueTask MenuAsync()

case ConsoleKey.D8:
case ConsoleKey.NumPad8:
var siteSample = serviceProvider.GetRequiredService<Site>();
await siteSample.Run();
var graphGroupSample = serviceProvider.GetRequiredService<GraphGroupExtensions>();
await graphGroupSample.Run();
break;

case ConsoleKey.D9:
case ConsoleKey.NumPad9:
var applicationPermissionsSample = serviceProvider.GetRequiredService<ApplicationPermissions>();
await applicationPermissionsSample.Run();
break;
default:
break;
Expand Down
3 changes: 0 additions & 3 deletions samples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ static async Task Main(string[] args)
services.AddTransient<SharePointSearch>();
services.AddTransient<SiteDesign>();
services.AddTransient<GraphGroupExtensions>();
services.AddTransient<Web>();
services.AddTransient<Site>();
services.AddTransient<ApplicationPermissions>();
})
.Build();

Expand Down
Loading

0 comments on commit 7fd5b6a

Please sign in to comment.