From bb7260a6083ebf90ac27025eb639411026fda6b0 Mon Sep 17 00:00:00 2001 From: Per Kops Date: Sat, 18 May 2024 15:30:28 +0200 Subject: [PATCH 1/4] fix: ensuring ServiceCollectionExtension method AddGraphService can survive no ILoggerFactory being registered --- .../Extensions/ServiceCollectionExtensions.cs | 14 ++++++++++---- src/Atc.Microsoft.Graph.Client/GlobalUsings.cs | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Atc.Microsoft.Graph.Client/Extensions/ServiceCollectionExtensions.cs b/src/Atc.Microsoft.Graph.Client/Extensions/ServiceCollectionExtensions.cs index 01531d6..ad494e0 100644 --- a/src/Atc.Microsoft.Graph.Client/Extensions/ServiceCollectionExtensions.cs +++ b/src/Atc.Microsoft.Graph.Client/Extensions/ServiceCollectionExtensions.cs @@ -100,9 +100,15 @@ private static void AddGraphService( where TService : class where TImplementation : GraphServiceClientWrapper, TService { - services.AddSingleton(s => (TImplementation)Activator.CreateInstance( - typeof(TImplementation), - s.GetRequiredService(), - s.GetRequiredService())!); + services.AddSingleton(s => + { + var loggerFactory = s.GetService() ?? new NullLoggerFactory(); + var graphServiceClient = s.GetRequiredService(); + + return (TImplementation)Activator.CreateInstance( + typeof(TImplementation), + loggerFactory, + graphServiceClient)!; + }); } } \ No newline at end of file diff --git a/src/Atc.Microsoft.Graph.Client/GlobalUsings.cs b/src/Atc.Microsoft.Graph.Client/GlobalUsings.cs index 9b6cd30..d1158bc 100644 --- a/src/Atc.Microsoft.Graph.Client/GlobalUsings.cs +++ b/src/Atc.Microsoft.Graph.Client/GlobalUsings.cs @@ -13,6 +13,7 @@ global using Azure.Identity; global using Microsoft.Extensions.DependencyInjection; global using Microsoft.Extensions.Logging; +global using Microsoft.Extensions.Logging.Abstractions; global using Microsoft.Graph; global using Microsoft.Graph.Drives.Item.List.Items; global using Microsoft.Graph.Models; From 60aad24308e02dc72135dbd624b1f0a3e3adcff0 Mon Sep 17 00:00:00 2001 From: Per Kops Date: Sat, 18 May 2024 15:33:51 +0200 Subject: [PATCH 2/4] feat: introduce sample application, showing the wire-up and usage of ISharepointGraphService --- .gitignore | 1 + Atc.Microsoft.Graph.Client.sln | 7 ++++ sample/.editorconfig | 4 +- .../Atc.Microsoft.Graph.Client.Sample.csproj | 29 ++++++++++++++ .../GlobalUsings.cs | 7 ++++ .../Program.cs | 39 +++++++++++++++++++ .../appsettings.json | 7 ++++ 7 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 sample/Atc.Microsoft.Graph.Client.Sample/Atc.Microsoft.Graph.Client.Sample.csproj create mode 100644 sample/Atc.Microsoft.Graph.Client.Sample/GlobalUsings.cs create mode 100644 sample/Atc.Microsoft.Graph.Client.Sample/Program.cs create mode 100644 sample/Atc.Microsoft.Graph.Client.Sample/appsettings.json diff --git a/.gitignore b/.gitignore index 8a30d25..35a4280 100644 --- a/.gitignore +++ b/.gitignore @@ -396,3 +396,4 @@ FodyWeavers.xsd # JetBrains Rider *.sln.iml +sample/Atc.Microsoft.Graph.Client.Sample/appsettings.Development.json diff --git a/Atc.Microsoft.Graph.Client.sln b/Atc.Microsoft.Graph.Client.sln index 70b1a3f..d877e74 100644 --- a/Atc.Microsoft.Graph.Client.sln +++ b/Atc.Microsoft.Graph.Client.sln @@ -16,6 +16,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{67FE0C EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Microsoft.Graph.Client", "src\Atc.Microsoft.Graph.Client\Atc.Microsoft.Graph.Client.csproj", "{E0C8319E-49CC-4A55-B356-986320EBF055}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Atc.Microsoft.Graph.Client.Sample", "sample\Atc.Microsoft.Graph.Client.Sample\Atc.Microsoft.Graph.Client.Sample.csproj", "{C742D749-CA38-4D8B-9FDB-5F3A35214D78}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -26,12 +28,17 @@ Global {E0C8319E-49CC-4A55-B356-986320EBF055}.Debug|Any CPU.Build.0 = Debug|Any CPU {E0C8319E-49CC-4A55-B356-986320EBF055}.Release|Any CPU.ActiveCfg = Release|Any CPU {E0C8319E-49CC-4A55-B356-986320EBF055}.Release|Any CPU.Build.0 = Release|Any CPU + {C742D749-CA38-4D8B-9FDB-5F3A35214D78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C742D749-CA38-4D8B-9FDB-5F3A35214D78}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C742D749-CA38-4D8B-9FDB-5F3A35214D78}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C742D749-CA38-4D8B-9FDB-5F3A35214D78}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {E0C8319E-49CC-4A55-B356-986320EBF055} = {69C84246-AA75-43E8-94B2-66FD555B18B0} + {C742D749-CA38-4D8B-9FDB-5F3A35214D78} = {67FE0C20-D944-47C5-A64E-AC05F7438940} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {04120463-05C5-417B-8D7A-2D7D35B71A07} diff --git a/sample/.editorconfig b/sample/.editorconfig index c630525..fe85d7f 100644 --- a/sample/.editorconfig +++ b/sample/.editorconfig @@ -48,4 +48,6 @@ dotnet_diagnostic.S1075.severity = none # Refactor your code not to ########################################## # Custom - Code Analyzers Rules -########################################## \ No newline at end of file +########################################## + +dotnet_diagnostic.CA1303.severity = none # \ No newline at end of file diff --git a/sample/Atc.Microsoft.Graph.Client.Sample/Atc.Microsoft.Graph.Client.Sample.csproj b/sample/Atc.Microsoft.Graph.Client.Sample/Atc.Microsoft.Graph.Client.Sample.csproj new file mode 100644 index 0000000..87875d3 --- /dev/null +++ b/sample/Atc.Microsoft.Graph.Client.Sample/Atc.Microsoft.Graph.Client.Sample.csproj @@ -0,0 +1,29 @@ + + + + Exe + net8.0 + false + + + + + + + + + + + + + + + + Always + + + Always + + + + diff --git a/sample/Atc.Microsoft.Graph.Client.Sample/GlobalUsings.cs b/sample/Atc.Microsoft.Graph.Client.Sample/GlobalUsings.cs new file mode 100644 index 0000000..40f6dab --- /dev/null +++ b/sample/Atc.Microsoft.Graph.Client.Sample/GlobalUsings.cs @@ -0,0 +1,7 @@ +global using System.Net; +global using Atc.Microsoft.Graph.Client.Extensions; +global using Atc.Microsoft.Graph.Client.Options; +global using Atc.Microsoft.Graph.Client.Services.Sharepoint; +global using Microsoft.Extensions.Configuration; +global using Microsoft.Extensions.DependencyInjection; +global using Microsoft.Extensions.Logging; \ No newline at end of file diff --git a/sample/Atc.Microsoft.Graph.Client.Sample/Program.cs b/sample/Atc.Microsoft.Graph.Client.Sample/Program.cs new file mode 100644 index 0000000..85c29c5 --- /dev/null +++ b/sample/Atc.Microsoft.Graph.Client.Sample/Program.cs @@ -0,0 +1,39 @@ +// ReSharper disable StringLiteralTypo +var configuration = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .AddJsonFile("appsettings.Development.json", optional: false, reloadOnChange: true) + .Build(); + +var services = new ServiceCollection(); + +services.AddLogging(configure => configure.AddConsole()); + +var graphServiceOptions = new GraphServiceOptions(); +configuration.GetRequiredSection("GraphServiceOptions").Bind(graphServiceOptions); + +services.AddMicrosoftGraphServices(graphServiceOptions); + +var serviceProvider = services.BuildServiceProvider(); + +var sharepointService = serviceProvider.GetRequiredService(); + +using var cts = new CancellationTokenSource(); + +var (statusCode, sites) = await sharepointService.GetSites( + selectQueryParameters: ["id", "webUrl", "isPersonalSite"], + cancellationToken: cts.Token); + +if (statusCode != HttpStatusCode.OK) +{ + Console.WriteLine("Failed to retrieve sites."); + return; +} + +foreach (var site in sites) +{ + Console.WriteLine($"SiteId: {site.Id}"); + Console.WriteLine($"WebUrl: {site.WebUrl}"); + Console.WriteLine($"IsPersonalSite: {site.IsPersonalSite}"); + Console.WriteLine("--------------------------------------"); +} \ No newline at end of file diff --git a/sample/Atc.Microsoft.Graph.Client.Sample/appsettings.json b/sample/Atc.Microsoft.Graph.Client.Sample/appsettings.json new file mode 100644 index 0000000..33301ab --- /dev/null +++ b/sample/Atc.Microsoft.Graph.Client.Sample/appsettings.json @@ -0,0 +1,7 @@ +{ + "GraphServiceOptions": { + "TenantId": "", + "ClientId": "", + "ClientSecret": "" + } +} \ No newline at end of file From 0a23c8354475c52455e96db3144b26435e95e286 Mon Sep 17 00:00:00 2001 From: Per Kops Date: Sat, 18 May 2024 15:34:04 +0200 Subject: [PATCH 3/4] docs: update README.md --- README.md | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 985c46b..2108471 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,91 @@ The library provides a convenient abstraction layer over the Microsoft Graph SDK, simplifying interactions with Microsoft Graph APIs. By wrapping the Microsoft Graph SDK, the library offers a consistent and simplified interface, handling complexities like paging and error handling for you. -# Table of Content +# Table of Contents - [Introduction](#introduction) -- [Table of Content](#table-of-content) +- [Table of Contents](#table-of-contents) +- [Atc.Microsoft.Graph.Client](#atcmicrosoftgraphclient) + - [Services](#services) + - [OneDriveGraphService](#onedrivegraphservice) + - [OutlookGraphService](#outlookgraphservice) + - [SharepointGraphService](#sharepointgraphservice) + - [TeamsGraphService](#teamsgraphservice) + - [UsersGraphService](#usersgraphservice) + - [Wire-Up Using ServiceCollection Extensions](#wire-up-using-servicecollection-extensions) + - [Options Available in the Extensions Class](#options-available-in-the-extensions-class) + - [Setup with ServiceCollection](#setup-with-servicecollection) +- [Sample Project](#sample-project) - [Requirements](#requirements) -- [How to contribute](#how-to-contribute) +- [How to Contribute](#how-to-contribute) + +# Atc.Microsoft.Graph.Client + +[![NuGet Version](https://img.shields.io/nuget/v/atc.microsoft.graph.client.svg?logo=nuget&style=for-the-badge)](https://www.nuget.org/packages/atc.microsoft.graph.client) + +## Services + +The services provided in the `Atc.Microsoft.Graph.Client` package are designed to facilitate seamless interaction with various Microsoft services through the Graph API. These services are essential for applications that need to manage and retrieve data efficiently from OneDrive, Outlook, SharePoint, Teams, User Management etc. By leveraging these services, applications can ensure robust and secure handling of data, integrating comprehensive functionalities directly into the application's workflow. Each service supports efficient querying of data, supporting expand, filter, and select query parameters to tailor the data retrieval process. + +### OneDriveGraphService + +The `IOneDriveGraphService` is essential for applications that require efficient management of OneDrive resources, including retrieving and managing drives and drive items, tracking changes with delta tokens, and downloading files. This service ensures robust and secure handling of OneDrive data, integrating OneDrive capabilities directly into the application's workflow. + +### OutlookGraphService + +The `IOutlookGraphService` is essential for applications that need to manage and retrieve Outlook mail data, such as mail folders, messages, and file attachments. It enables efficient querying of mail folders and messages, supports the use of delta tokens for tracking changes, and ensures secure handling of email data, enhancing email management within the application's ecosystem. + +### SharepointGraphService + +The `ISharepointGraphService` is essential for applications that need to manage SharePoint sites and subscriptions effectively. It provides capabilities for retrieving site information, setting up and managing subscriptions, and handling subscription renewals and deletions, ensuring robust and efficient integration of SharePoint functionalities within the application's environment. + +### `TeamsGraphService` + +The ITeamsGraphService is essential for applications that need to retrieve and manage information about Teams. It allows for efficient querying of Teams data, enhancing collaboration and communication capabilities within the application's ecosystem. + +### UsersGraphService + +The `IUsersGraphService` is essential for applications that need to retrieve and manage information about users. It allows for efficient querying of user data, ensuring robust and efficient integration of user management functionalities within the application's environment. + +## Wire-Up Using ServiceCollection Extensions + +To seamlessly integrate the Graph services into your application, you can utilize the provided [`ServiceCollection`](src/Atc.Microsoft.Graph.Client/Extensions/ServiceCollectionExtensions.cs) extension methods. These methods simplify the setup process and ensure that the Graph services are correctly configured and ready to use within your application's service architecture. + +The methods ensure that the Graph services are added to the application's service collection and configured according to the specified parameters, making them available throughout your application via dependency injection. + +The configuration example below utilize the application's settings (typically defined in appsettings.json) to configure the Graph Services by calling the overload that accepts `GraphServiceOptions` and implicitly configures the GraphServiceClient utilizing a ClientSecretCredential. + +### Options Available in the Extensions Class +The `ServiceCollectionExtensions` class provides several methods to add and configure the Graph services in your application: + +- AddMicrosoftGraphServices(GraphServiceClient? graphServiceClient = null) + > Adds the GraphServiceClient to the service collection, optionally using a provided GraphServiceClient instance. If no instance is provided, one must be available in the service provider when this service is resolved. + +- AddMicrosoftGraphServices(TokenCredential tokenCredential, string[]? scopes = null) + > Adds the GraphServiceClient to the service collection using the provided TokenCredential for authentication. Optional scopes can also be specified. + +- AddMicrosoftGraphServices(GraphServiceOptions graphServiceOptions, string[]? scopes = null) + > Adds the GraphServiceClient to the service collection using the provided GraphServiceOptions. This method ensures the GraphServiceClient is configured with a ClientSecretCredential based on the specified options. + +### Setup with ServiceCollection + +```csharp +public void ConfigureServices(IServiceCollection services) +{ + var graphServiceOptions = new GraphServiceOptions + { + TenantId = "your_tenant_id", + ClientId = "your_client_id", + ClientSecret = "your_client_secret", + }; + + services.AddMicrosoftGraphServices(graphServiceOptions); +} +``` + +# Sample Project + +A [sample](sample/Atc.Microsoft.Graph.Client.Sample/Program.cs) is included, demonstrating how to configure and use the Microsoft Graph services. # Requirements From 27b27c5633b013180743130db6334a09b1503618 Mon Sep 17 00:00:00 2001 From: Per Kops Date: Sat, 18 May 2024 15:37:06 +0200 Subject: [PATCH 4/4] feat: setting expandQueryParameters, filterQueryParameter and selectQueryParameters in all Services to default null value --- .../OneDrive/IOneDriveGraphService.cs | 16 +++++----- .../Services/OneDrive/OneDriveGraphService.cs | 16 +++++----- .../Services/Outlook/IOutlookGraphService.cs | 30 +++++++++---------- .../Services/Outlook/OutlookGraphService.cs | 30 +++++++++---------- .../Sharepoint/ISharepointGraphService.cs | 6 ++-- .../Sharepoint/SharepointGraphService.cs | 6 ++-- .../Services/Teams/ITeamsGraphService.cs | 6 ++-- .../Services/Teams/TeamsGraphService.cs | 6 ++-- .../Services/Users/IUsersGraphService.cs | 6 ++-- .../Services/Users/UsersGraphService.cs | 6 ++-- 10 files changed, 64 insertions(+), 64 deletions(-) diff --git a/src/Atc.Microsoft.Graph.Client/Services/OneDrive/IOneDriveGraphService.cs b/src/Atc.Microsoft.Graph.Client/Services/OneDrive/IOneDriveGraphService.cs index 1a5e0ec..8266605 100644 --- a/src/Atc.Microsoft.Graph.Client/Services/OneDrive/IOneDriveGraphService.cs +++ b/src/Atc.Microsoft.Graph.Client/Services/OneDrive/IOneDriveGraphService.cs @@ -4,9 +4,9 @@ public interface IOneDriveGraphService { Task<(HttpStatusCode StatusCode, IList Data)> GetDrivesBySiteId( Guid siteId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default); Task GetDriveByTeamId( @@ -19,16 +19,16 @@ public interface IOneDriveGraphService Task<(HttpStatusCode StatusCode, IList Data)> GetDriveItemsByDriveId( string driveId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default); Task<(HttpStatusCode StatusCode, IList Data)> GetDriveItemsByDriveIdAndDeltaToken( string driveId, string deltaToken, - string? filterQueryParameter, - List? selectQueryParameters, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default); Task DownloadFile( diff --git a/src/Atc.Microsoft.Graph.Client/Services/OneDrive/OneDriveGraphService.cs b/src/Atc.Microsoft.Graph.Client/Services/OneDrive/OneDriveGraphService.cs index dc25d7b..1e964f3 100644 --- a/src/Atc.Microsoft.Graph.Client/Services/OneDrive/OneDriveGraphService.cs +++ b/src/Atc.Microsoft.Graph.Client/Services/OneDrive/OneDriveGraphService.cs @@ -11,9 +11,9 @@ public OneDriveGraphService( public async Task<(HttpStatusCode StatusCode, IList Data)> GetDrivesBySiteId( Guid siteId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default) { List pagedItems = []; @@ -159,9 +159,9 @@ public OneDriveGraphService( public async Task<(HttpStatusCode StatusCode, IList Data)> GetDriveItemsByDriveId( string driveId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default) { var requestInformation = Client @@ -187,8 +187,8 @@ public OneDriveGraphService( public async Task<(HttpStatusCode StatusCode, IList Data)> GetDriveItemsByDriveIdAndDeltaToken( string driveId, string deltaToken, - string? filterQueryParameter, - List? selectQueryParameters, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default) { List pagedItems = []; diff --git a/src/Atc.Microsoft.Graph.Client/Services/Outlook/IOutlookGraphService.cs b/src/Atc.Microsoft.Graph.Client/Services/Outlook/IOutlookGraphService.cs index 25eee9b..c1cee11 100644 --- a/src/Atc.Microsoft.Graph.Client/Services/Outlook/IOutlookGraphService.cs +++ b/src/Atc.Microsoft.Graph.Client/Services/Outlook/IOutlookGraphService.cs @@ -4,40 +4,40 @@ public interface IOutlookGraphService { Task<(HttpStatusCode StatusCode, IList Data)> GetRootMailFoldersByUserId( string userId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default); Task<(HttpStatusCode StatusCode, IList Data)> GetMailFoldersByUserIdAndFolderId( string userId, string folderId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default); Task<(HttpStatusCode StatusCode, IList Data)> GetMessagesByUserId( string userId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default); Task<(HttpStatusCode StatusCode, IList Data, string? DeltaToken)> GetMessagesByUserIdAndFolderId( string userId, string folderId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, string? deltaToken = null, CancellationToken cancellationToken = default); Task<(HttpStatusCode StatusCode, IList Data)> GetFileAttachmentsByUserIdAndMessageId( string userId, string messageId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/src/Atc.Microsoft.Graph.Client/Services/Outlook/OutlookGraphService.cs b/src/Atc.Microsoft.Graph.Client/Services/Outlook/OutlookGraphService.cs index 8b41ae2..f34a1d4 100644 --- a/src/Atc.Microsoft.Graph.Client/Services/Outlook/OutlookGraphService.cs +++ b/src/Atc.Microsoft.Graph.Client/Services/Outlook/OutlookGraphService.cs @@ -11,9 +11,9 @@ public OutlookGraphService( public async Task<(HttpStatusCode StatusCode, IList Data)> GetRootMailFoldersByUserId( string userId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default) { List pagedItems = []; @@ -90,9 +90,9 @@ public OutlookGraphService( public async Task<(HttpStatusCode StatusCode, IList Data)> GetMailFoldersByUserIdAndFolderId( string userId, string folderId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default) { List pagedItems = []; @@ -169,9 +169,9 @@ public OutlookGraphService( public async Task<(HttpStatusCode StatusCode, IList Data)> GetMessagesByUserId( string userId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default) { List pagedItems = []; @@ -248,9 +248,9 @@ public OutlookGraphService( public async Task<(HttpStatusCode StatusCode, IList Data, string? DeltaToken)> GetMessagesByUserIdAndFolderId( string userId, string folderId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, string? deltaToken = null, CancellationToken cancellationToken = default) { @@ -289,9 +289,9 @@ public OutlookGraphService( public async Task<(HttpStatusCode StatusCode, IList Data)> GetFileAttachmentsByUserIdAndMessageId( string userId, string messageId, - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default) { List pagedItems = []; diff --git a/src/Atc.Microsoft.Graph.Client/Services/Sharepoint/ISharepointGraphService.cs b/src/Atc.Microsoft.Graph.Client/Services/Sharepoint/ISharepointGraphService.cs index 791706a..5ffcaeb 100644 --- a/src/Atc.Microsoft.Graph.Client/Services/Sharepoint/ISharepointGraphService.cs +++ b/src/Atc.Microsoft.Graph.Client/Services/Sharepoint/ISharepointGraphService.cs @@ -3,9 +3,9 @@ namespace Atc.Microsoft.Graph.Client.Services.Sharepoint; public interface ISharepointGraphService { Task<(HttpStatusCode StatusCode, IList Data)> GetSites( - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default); Task<(HttpStatusCode StatusCode, Guid? SubscriptionId)> SetupSubscription( diff --git a/src/Atc.Microsoft.Graph.Client/Services/Sharepoint/SharepointGraphService.cs b/src/Atc.Microsoft.Graph.Client/Services/Sharepoint/SharepointGraphService.cs index d5b9823..849a0ac 100644 --- a/src/Atc.Microsoft.Graph.Client/Services/Sharepoint/SharepointGraphService.cs +++ b/src/Atc.Microsoft.Graph.Client/Services/Sharepoint/SharepointGraphService.cs @@ -10,9 +10,9 @@ public SharepointGraphService( } public async Task<(HttpStatusCode StatusCode, IList Data)> GetSites( - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default) { List pagedItems = []; diff --git a/src/Atc.Microsoft.Graph.Client/Services/Teams/ITeamsGraphService.cs b/src/Atc.Microsoft.Graph.Client/Services/Teams/ITeamsGraphService.cs index 3aa4bc0..c74c559 100644 --- a/src/Atc.Microsoft.Graph.Client/Services/Teams/ITeamsGraphService.cs +++ b/src/Atc.Microsoft.Graph.Client/Services/Teams/ITeamsGraphService.cs @@ -3,8 +3,8 @@ namespace Atc.Microsoft.Graph.Client.Services.Teams; public interface ITeamsGraphService { Task<(HttpStatusCode StatusCode, IList Data)> GetTeams( - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/src/Atc.Microsoft.Graph.Client/Services/Teams/TeamsGraphService.cs b/src/Atc.Microsoft.Graph.Client/Services/Teams/TeamsGraphService.cs index 5caf889..ac54c9f 100644 --- a/src/Atc.Microsoft.Graph.Client/Services/Teams/TeamsGraphService.cs +++ b/src/Atc.Microsoft.Graph.Client/Services/Teams/TeamsGraphService.cs @@ -10,9 +10,9 @@ public TeamsGraphService( } public async Task<(HttpStatusCode StatusCode, IList Data)> GetTeams( - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default) { List pagedItems = []; diff --git a/src/Atc.Microsoft.Graph.Client/Services/Users/IUsersGraphService.cs b/src/Atc.Microsoft.Graph.Client/Services/Users/IUsersGraphService.cs index 9bc96fa..2a4f945 100644 --- a/src/Atc.Microsoft.Graph.Client/Services/Users/IUsersGraphService.cs +++ b/src/Atc.Microsoft.Graph.Client/Services/Users/IUsersGraphService.cs @@ -3,8 +3,8 @@ namespace Atc.Microsoft.Graph.Client.Services.Users; public interface IUsersGraphService { Task<(HttpStatusCode StatusCode, IList Data)> GetUsers( - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/src/Atc.Microsoft.Graph.Client/Services/Users/UsersGraphService.cs b/src/Atc.Microsoft.Graph.Client/Services/Users/UsersGraphService.cs index 2516220..ad4a787 100644 --- a/src/Atc.Microsoft.Graph.Client/Services/Users/UsersGraphService.cs +++ b/src/Atc.Microsoft.Graph.Client/Services/Users/UsersGraphService.cs @@ -10,9 +10,9 @@ public UsersGraphService( } public async Task<(HttpStatusCode StatusCode, IList Data)> GetUsers( - List? expandQueryParameters, - string? filterQueryParameter, - List? selectQueryParameters, + List? expandQueryParameters = null, + string? filterQueryParameter = null, + List? selectQueryParameters = null, CancellationToken cancellationToken = default) { List pagedItems = [];