Skip to content

Commit

Permalink
Sample update
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Schaeflein committed Apr 24, 2024
1 parent 5fb391b commit ba9292d
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions sample/Diagnostics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,31 @@ public async Task Run()

var credential = new ChainedTokenCredential(
new SharedTokenCacheCredential(new SharedTokenCacheCredentialOptions() { TenantId = azureAdSettings.TenantId, ClientId = azureAdSettings.ClientId }),
//new VisualStudioCredential(new VisualStudioCredentialOptions { TenantId = azureAdSettings.TenantId }),
new InteractiveBrowserCredential(new InteractiveBrowserCredentialOptions { TenantId = azureAdSettings.TenantId, ClientId = azureAdSettings.ClientId })
);


////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
//
// Graph Client with Logger and SharePoint service handler
// SharePoint REST Client with Logger and SharePoint service handler
//
////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////

// Configure our client
SPClientOptions clientOptions = new ()
SPClientOptions clientOptions = new()
{
// use the default user agent

//UserAgentInfo = new SharePointThrottlingDecoration()
//{
// CompanyName = "Company",
// AppName = "Application",
// AppVersion = "0.0.0",
// ISV = false
//},

// use our logger
MessageLogger = logger

// use the default user agent
};

var spClient = SPClientFactory.Create(sharePointSettings.SpoTenantUrl, credential, clientOptions);
Expand All @@ -81,9 +88,13 @@ public async Task Run()

try
{
var web = await spClient[sharePointSettings.ServerRelativeSiteUrl]._api.Web.GetAsync();
var web = await spClient[sharePointSettings.ServerRelativeSiteUrl]._api.Web.GetAsync(config =>
{
config.QueryParameters.Expand = ["UserCustomActions"];
});

Console.WriteLine($"Title: {web.Title}");
Console.WriteLine($"Title: {web?.Title}");
Console.WriteLine($"UserCustomAction count: {web?.UserCustomActions?.Count ?? 0}");
Console.WriteLine();
}
catch (Exception ex)
Expand Down

0 comments on commit ba9292d

Please sign in to comment.