Aspose.Slides.SaaSIntegrations 25.7.0

dotnet add package Aspose.Slides.SaaSIntegrations --version 25.7.0
                    
NuGet\Install-Package Aspose.Slides.SaaSIntegrations -Version 25.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aspose.Slides.SaaSIntegrations" Version="25.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aspose.Slides.SaaSIntegrations" Version="25.7.0" />
                    
Directory.Packages.props
<PackageReference Include="Aspose.Slides.SaaSIntegrations" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aspose.Slides.SaaSIntegrations --version 25.7.0
                    
#r "nuget: Aspose.Slides.SaaSIntegrations, 25.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Aspose.Slides.SaaSIntegrations@25.7.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Aspose.Slides.SaaSIntegrations&version=25.7.0
                    
Install as a Cake Addin
#tool nuget:?package=Aspose.Slides.SaaSIntegrations&version=25.7.0
                    
Install as a Cake Tool

Integrating Aspose.Slides with Google Slides and Canva

Aspose.Slides team exited to introduce our new Google Slides, Google Drive and Canva SaaS integrations. Convert, edit, download and upload Google Slides or Canva presentations programmatically using Aspose.Slides SaaS Integrations.

Google API

Before starting to work with your Google Slides presentation via Aspose.Slides you have to create a Google API project and create a Google Cloud project, then enable the desired APIs. Then you have to choose a way you are going to access Google API.

Aspose.Slide Google Slides SaaS Integration supports two ways to access Google API: Google Service Account or OAuth 2.0 with user interaction via a browser.

Google Servise Account

A service account is a special Google account used by applications or servers to access Google APIs programmatically without user interaction. It’s commonly used for backend systems or automated tasks. Service accounts are authenticated using a JSON key file and have their own email address. They can be assigned specific permissions through Google Cloud IAM and are often used with APIs like Google Drive, Sheets, or BigQuery for secure, automated access to resources.

OAuth 2.0

Another common way to access Google APIs is through OAuth 2.0 with user interaction via a browser. In this flow, the user is redirected to a Google sign-in page where they grant permission to the app. After approval, the app receives an authorization code, which it exchanges for an access token and a refresh token.

The access token allows temporary access to Google APIs, while the refresh token can be stored and reused to obtain new access tokens without requiring the user to log in again. This means browser interaction is required only once, making subsequent API access fully automated. This method is typically used for apps that need to access a user's data (like Gmail, Calendar, or Drive) with the user's consent.

Canva API

Before working with Canva presentations using Aspose.Slides, you must first create a Canva integration, enable the required APIs, and configure the redirection URI. In general, working with Canva via our library is similar to working with Google Slides. However, instead of the Google Slides-specific classes, use the CanvaIntegration class along with the dedicated ICanvaAuthorizationProvider. Canva supports OAuth 2.0 authorization only.

Let's code

First, add the Aspose.Slides SaaS Integration NuGet package to your project:

dotnet add package Aspose.Slides.SaaSIntegrations

Example 1

In the following example, we will download a Google Slides presentation from Google Drive and save it to the local disk as a PDF file. We will use a Google Service Account for authorization, assuming the service account JSON file with credentials has already been downloaded.

// Create externally managed HttpClient
HttpClient httpClient = new HttpClient();

// Create an authorization provider using a service account JSON file
IGoogleAuthorizationProvider account = new GoogleServiceAccountAuthProvider(@"service_account_json_file.json", httpClient);

// Initialize Google Slides integration service with the authorization provider
GoogleSlidesIntegration googleSlidesIntegration = new GoogleSlidesIntegration(account, httpClient);

// Load a presentation from Google Drive by its file ID into an Aspose.Slides IPresentation instance
using IPresentation pres = await googleSlidesIntegration.LoadPresentationAsync("1A2B3C4D5E6F7G8H9I0J");

// Modify the presentation if needed (e.g., remove the second slide)
pres.Slides.RemoveAt(1);

// Save the presentation locally as a PDF file
pres.Save(@"GoogleDriveDownload.pdf", SaveFormat.Pdf);

For convenience, Aspose.Slides SaaS Integration provides a method to list all files available to the user. The returned data includes the file name, MIME type, and file ID.

// Get the list of files available to the provided service account
var availableFiles = await googleSlidesIntegration.GetDriveFileInfosAsync();

foreach (GoogleDriveFileInfo googleDriveFileInfo in availableFiles)
{
    Console.WriteLine($"File name: {googleDriveFileInfo.Name}, File ID: {googleDriveFileInfo.Id}, MIME type: {googleDriveFileInfo.MimeType}");
}

Another way to find the file ID is to open the presentation in the Google Slides web app and locate it in the URL.

For example, in the following URL:

https://docs.google.com/presentation/d/1A2B3C4D5E6F7G8H9I0J/edit

The file ID is:

1A2B3C4D5E6F7G8H9I0J

Example 2

In the next example, we will create a PowerPoint presentation from scratch and upload it to Google Drive in Google Slides format. For authorization, we will use OAuth 2.0.

// Create externally managed HttpClient
HttpClient httpClient = new HttpClient();

// Create an authorization provider using OAuth with client ID and client secret
IGoogleAuthorizationProvider account = new GoogleOAuthProvider("clientId", "clientSecret", httpClient);

// Initialize the Google Slides integration service with the authorization provider
GoogleSlidesIntegration googleSlidesIntegration = new GoogleSlidesIntegration(account, httpClient);

// Create a sample presentation
using (var presentation = new Presentation())
{
    var shape = presentation.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 300, 200);
    shape.TextFrame.Text = "Hello from Google Drive!";
    
    // Save the presentation to Google Drive root folder in Google Slides format
    // You can also choose any other export format supported by Aspose.Slides
    var newFileId = await googleSlidesIntegration.SavePresentationAsync(presentation, "New presentation", GoogleSaveFormatType.GoogleSlides);
    Console.WriteLine($"Uploaded file ID: {newFileId}");
}

If you use this type of authorization in your app, interaction with the browser is required. You will need to select your account and confirm that you allow the app to access your Google Drive API. That’s it—this operation is only required on the first run.

Example 3

In the following example we will use preobtained access token. GoogleAccessTokenAuthProvider is an implementation of the IGoogleAuthorizationProvider interface that uses an existing OAuth 2.0 access token to authorize requests to Google APIs. Unlike providers that initiate or manage the OAuth flow, this class relies on the caller to supply a valid access token.

This provider is useful in systems where the access token is obtained externally—typically by a frontend application or another service—and passed to the backend. It is especially suitable for distributed environments where managing refresh tokens server-side introduces complexity or risk of token invalidation due to concurrent refresh attempts.

This example demonstrates how to replace a file and update its name on Google Drive while preserving its file ID.

// Create an HTTP client for making requests
using HttpClient httpClient = new HttpClient();

// Set up Google Drive authentication using an access token
GoogleAccessTokenAuthProvider accessTokenAuthProvider = new GoogleAccessTokenAuthProvider("access_token");

// Initialize integration with Google Slides/Drive using the authentication and HTTP client
GoogleSlidesIntegration googleSlidesIntegration =
    new GoogleSlidesIntegration(accessTokenAuthProvider, httpClient);

// Create a sample presentation using Aspose.Slides
using (var presentation = new Presentation())
{
    // Add a rectangle shape to the first slide and set its text
    var shape = presentation.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 100, 100, 300, 200);
    shape.TextFrame.Text = "Hello from Google Drive!";

    // Define PDF save options with specific quality and compliance settings
    ISaveOptions saveOptions = new PdfOptions()
    {
        JpegQuality = 50,
        Compliance = PdfCompliance.PdfA1b
    };

    // Save (replace) the existing file on Google Drive by file ID, update its name, and export as PDF
    await googleSlidesIntegration.SavePresentationToExistingFileAsync(
        presentation,
        "1A2B3C4D5E6F7G8H9I0J",            // ID of the existing file on Google Drive
        GoogleSaveFormatType.Pdf,         // Desired format to save as
        saveOptions,           
        "NewFileName.pdf"                 // New name to assign to the file
    );
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
25.7.0 0 7/17/2025

Added Google Slides and Google Drive support
Added Canva support