Skip to content

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.

License

Notifications You must be signed in to change notification settings

atc-net/atc-microsoft-graph-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

60 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š Introduction

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, retry logic, and error handling for you.

Table of Contents

Atc.Microsoft.Graph.Client

NuGet Version

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 Calendar, Contacts, OneDrive, Outlook, SharePoint, Teams, User Management and more. 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.

πŸ“… CalendarGraphService

The ICalendarGraphService provides operations for managing user calendars and events via the Microsoft Graph API. It supports retrieving calendars, listing events, and querying calendar views within a specified date range.

πŸ‘€ ContactsGraphService

The IContactsGraphService provides full CRUD operations for managing user contacts. It supports listing contacts with OData query parameters, retrieving individual contacts by ID, creating new contacts, updating existing contacts, and deleting contacts.

πŸ‘₯ GroupsGraphService

The IGroupsGraphService provides operations for managing Azure AD groups. It supports listing groups, retrieving individual groups by ID, and querying group members and owners.

πŸ’Ύ 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.

πŸŽ₯ OnlineMeetingsGraphService

The IOnlineMeetingsGraphService provides full CRUD operations for managing online meetings. It supports listing meetings for a user, retrieving individual meetings by ID, creating new meetings, updating existing meetings, and deleting meetings.

πŸ“§ OutlookGraphService

The IOutlookGraphService provides operations for interacting with Outlook mail. It supports retrieving mail folders, messages, and file attachments, with delta tracking for incremental sync. It also provides mail write operations including sending mail, creating and sending draft messages, replying to messages, replying all, and forwarding messages.

πŸ” SearchGraphService

The ISearchGraphService provides a pass-through to the Microsoft Graph Search API. It accepts a QueryPostRequestBody and returns search results, enabling full-text search across Microsoft 365 content.

πŸ“ SharepointGraphService

The ISharepointGraphService provides operations for managing SharePoint sites, lists, and list items. It supports retrieving sites, listing SharePoint lists for a site, and querying list items.

πŸ”” SubscriptionsGraphService

The ISubscriptionsGraphService provides operations for managing Microsoft Graph webhook subscriptions. It supports listing active subscriptions, creating new subscriptions, renewing subscriptions with updated expiration dates, and deleting subscriptions.

πŸ’¬ TeamsGraphService

The ITeamsGraphService provides operations for retrieving and managing information about Teams, including listing teams, querying channels, and managing team members.

πŸ§‘β€πŸ’Ό UsersGraphService

The IUsersGraphService provides operations for retrieving and managing user information, including listing users, retrieving individual users by ID, querying user group memberships, and looking up user managers.

Wire-Up Using ServiceCollection Extensions

To seamlessly integrate the Graph services into your application, you can utilize the provided ServiceCollection 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

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 is included, demonstrating how to configure and use the Microsoft Graph services.

βš™οΈ Requirements

🀝 How to contribute

Contribution Guidelines

Coding Guidelines

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages