GithubHelp home page GithubHelp logo

isabella232 / powerpoint-add-in-microsoft-graph-aspnet-insertchart Goto Github PK

View Code? Open in Web Editor NEW

This project forked from officedev/powerpoint-add-in-microsoft-graph-aspnet-insertchart

0.0 0.0 0.0 1.82 MB

An add-in connecting to OneDrive, finds workbooks, returns charts and inserts charts onto slides using Office.js

License: Other

C# 0.86% CSS 0.13% ASP 0.01% JavaScript 98.62% HTML 0.38%

powerpoint-add-in-microsoft-graph-aspnet-insertchart's Introduction

page_type products languages extensions
sample
office-powerpoint
office-excel
office-365
office-onedrive
ms-graph
javascript
contentType technologies services createdDate
samples
Add-ins
Microsoft Graph
Excel
Office 365
OneDrive
3/17/2016 9:42:20 AM

Insert Excel charts using Microsoft Graph in a PowerPoint Add-in

Learn how to build a Microsoft Office Add-in that connects to Microsoft Graph, finds all workbooks stored in OneDrive for Business, fetches all charts in the workbooks using the Excel REST APIs, and inserts an image of a chart into a PowerPoint slide using Office.js.

Insert Excel charts using Microsoft Graph in a PowerPoint Add-in sample

Introduction

Integrating data from online service providers increases the value and adoption of your add-ins. This code sample shows you how to connect your add-in to Microsoft Graph. Use this code sample to:

  • Connect to Microsoft Graph from an Office Add-in.
  • Use the MSAL .NET Library to implement the OAuth 2.0 authorization framework in an add-in.
  • Use the Excel and OneDrive REST APIs from Microsoft Graph.
  • Show a dialog using the Office UI namespace.
  • Build an Add-in using ASP.NET MVC,MSAL, and Office.js.
  • Use add-in commands in PowerPoint.

Prerequisites

To run this code sample, the following are required.

  • Visual Studio 2019 or later.

  • SQL Server Express (No longer automatically installed with recent versions of Visual Studio.)

  • An Office 365 account which you can get by joining the Office 365 Developer Program that includes a free 1 year subscription to Office 365.

  • Excel workbooks (with charts) stored on OneDrive for Business in your Office 365 subscription.

  • PowerPoint for Windows Desktop, version 16.0.6769.2001 or higher.

  • Office Developer Tools

  • A Microsoft Azure Tenant. This add-in requires Azure Active Directiory (AD). Azure AD provides identity services that applications use for authentication and authorization. A trial subscription can be acquired here: Microsoft Azure.

Configure the project

  1. Ensure your Azure subscription is bound to your Office 365 tenant. For more information, see the Active Directory team's blog post, Creating and Managing Multiple Windows Azure Active Directories. The section Adding a new directory will explain how to do this. You can also see Set up your Office 365 development environment and the section Associate your Office 365 account with Azure AD to create and manage apps for more information.

  2. Register your application using the Azure Management Portal. Sign-in with the account of an administrator or your Office 365 subscription. To learn how to register your application, see Register an application with the Microsoft identity platforml. Use the following settings:

  • REDIRCT URI: https://localhost:44301/AzureADAuth/Authorize

  • SUPPORTED ACCOUNT TYPES: "Accounts in this organizational directory only"

  • IMPLICIT GRANT: Do not enable any Implicit Grant options

  • API PERMISSIONS: Files.Read.All and User.Read

    Note: After you register your application, copy the Application (client) ID and the Directory (tenant) ID on the Overview blade of the App Registration in the Azure Management Portal. When you create the client secret on the Certificates & secrets blade, copy it too.

  1. In web.config, use the values that you copied in the previous step. Set AAD:ClientID to your client id, set AAD:ClientSecret to your client secret, and set "AAD:O365TenantID" to your tenant ID.

  2. Open the solution in Visual Studio, and open Solution Explorer and then choose the PowerPoint-Add-in-Microsoft-Graph-ASPNET-InsertChartWeb project. In Properties, ensure SSL Enabled is True. Verify that the SSL URLproperty uses the same domain name and port number as those listed in step 2 above.

  3. In Solution Explorer, right-click the topmost node -- the Solution ... node. Select Set Startup Projects. In the dialog that opens, expand Common Properites and select Startup Project. Enable Multiple startup projects. Ensure that the project whose name ends with "Web" is listed first and that both projects are set to Start in the Action column.

Run the project

  1. Build the solution.
  2. Press F5.
  3. In PowerPoint, open the Insert tab, and select Pick a chart to open the task pane add-in. The home page provides instructions.

Known issues

  • Scenario: When trying to run the code sample, the add-in will not load.
    • Resolution:
      1. In Visual Studio, open SQL Server Object Explorer.
      2. Expand (localdb)\MSSQLLocalDB > Databases.
      3. Right click PowerPoint-Add-in-Microsoft-Graph-ASPNET-InsertChart, then choose Delete.
  • Scenario: When you run the code sample, you get an error on the line Office.context.ui.messageParent.
    • Resolution: Stop running the code sample and restart it.
  • If download the zip file, when you extract the files you get an error indicating that the file path is too long.
    • Resolution: Unzip your files to a folder directly under the root (e.g. c:\sample).

Questions and comments

We'd love to get your feedback about the Insert Excel charts using Microsoft Graph in a PowerPoint Add-in sample. You can send your feedback to us in the Issues section of this repository. Questions about Office 365 development in general should be posted to Stack Overflow. Ensure your questions are tagged with [office-js], [MicrosoftGraph] and [API].

Additional resources

Copyright

Copyright (c) 2016 - 2019 Microsoft Corporation. All rights reserved.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

powerpoint-add-in-microsoft-graph-aspnet-insertchart's People

Contributors

davidchesnut avatar mimisasouvanh avatar nokafor avatar o365devx avatar officegsx avatar reezaali avatar rick-kirkham avatar tadaomachida avatar v-pazal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.