Coder Social home page Coder Social logo

microsoftgraph / botframework-csharp-excelbot-rest-sample Goto Github PK

View Code? Open in Web Editor NEW
29.0 17.0 16.0 480 KB

[ARCHIVED] Excel Bot is a bot built with the Microsoft Bot Framework that demonstrates how to use Excel with the Microsoft Graph API

License: Other

C# 96.80% ASP 0.07% HTML 3.12%
devxsample

botframework-csharp-excelbot-rest-sample's Introduction

[ARCHIVED] Excel Bot

IMPORTANT

This project is being archived and replaced with the ApprovalBot sample. As part of the archival process, we're closing all open issues and pull requests.

You can continue to use this sample "as-is", but it won't be maintained moving forward. We apologize for any inconvenience.

Table of Contents.

Introduction.

Prerequisites.

Cloning or downloading this repository.

Configure your Azure AD tenant.

Register the bot.

Give us your feedback

Introduction.

Excel Bot is a sample that demonstrates how to use the Microsoft Graph and specifically the Excel REST API to access Excel workbooks stored in OneDrive for Business through a conversational user interface. It is written in C# and it uses the Microsoft Bot Framework and the Language Understanding Intelligent Service (LUIS).

Note: The code in this sample was originally written for a user experience prototype and does not necessarily demonstrate how to create production quality code.

Prerequisites.

This sample requires the following:

  • Visual Studio 2017.
  • An Office 365 for business account. You can sign up for an Office 365 Developer subscription that includes the resources that you need to start building Office 365 apps.

Cloning or downloading this repository.

  • Clone this repo to a local folder

    git clone https://github.com/nicolesigei/botframework-csharp-excelbot-rest-sample.git

Configure your Azure AD tenant.

  1. Open a browser and navigate to the Azure Active Directory admin center. Login using a Work or School Account.

  2. Select Azure Active Directory in the left-hand navigation, then select App registrations under Manage.

    A screenshot of the App registrations

  3. Select New registration. On the Register an application page, set the values as follows.

    • Set a preferred Name e.g. Excel Bot App.
    • Set Supported account types to Accounts in any organizational directory.
    • Under Redirect URI, set the first drop-down to Web and set the value to http://localhost:3978/callback.

    A screenshot of the Register an application page

    Note: If you are running this locally and on Azure, you should add two redirect URLs here, one to your local instance and one to your Azure web app.

  4. Choose Register. On the Excel Bot App page, copy the value of the Application (client) ID and save it, you will need it to configure the app.

    A screenshot of the application ID of the new app registration

  5. Select Certificates & secrets under Manage. Select the New client secret button. Enter a value in Description and select one of the options for Expires and choose Add.

    A screenshot of the Add a client secret dialog

  6. Copy the client secret value before you leave this page. You will need it to configure the app.

    [!IMPORTANT] This client secret is never shown again, so make sure you copy it now.

    A screenshot of the newly added client secret

Register the bot.

Complete the these steps to setup your development environment to build and test the Excel bot:

  • Download and install the Azure Cosmos DB Emulator

  • Make a copy of ./ExcelBot/PrivateSettings.config.example in the same directory. Name the file to PrivateSettings.config.

  • Open the ExcelBot.sln solution file

  • Register the bot in the Bot Framework

  • Copy the bot MicrosoftAppId and MicrosoftAppPassword to the PrivateSettings.config file

  • Register the bot to call the Microsoft Graph.

  • Copy the Azure Active Directory Client Id and Secret to the PrivateSettings.config file

  • Create a new model in the LUIS service

  • Import the LUIS\excelbot.json file into LUIS

  • Train and publish the LUIS model

  • Copy the LUIS model id and subscription key to the Dialogs\ExcelBotDialog.cs file

  • (Optional) Enable Web Chat for the bot in the Bot Framework and copy the Web Chat embed template the chat.htm file

  • (Optional) To get the bot to send telemetry to Visual Studio Application Insights, copy the instrumentation key to the following files: ApplicationInsights.config, default.htm, loggedin.htm, chat.htm

  • Build the solution

  • Press F5 to start the bot locally

  • Test the bot locally with the Bot Framework Emulator

  • Create an Azure Cosmos DB in Azure that uses the SQL API

  • Replace the bots host name in the PrivateSettings.config file

  • Replace the database URI and key in the PrivateSettings.config file

  • Publish the solution to the Azure web app

  • Test the deployed bot using the Web Chat control by browsing to the chat.htm page

Give us your feedback

Your feedback is important to us.

Check out the sample code and let us know about any questions and issues you find by submitting an issue directly in this repository. Provide repro steps, console output, and error messages in any issue you open.

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.

Copyright

Copyright (c) 2019 Microsoft. All rights reserved.

botframework-csharp-excelbot-rest-sample's People

Contributors

darrelmiller avatar irvinesunday avatar jakobpn avatar jasonjoh avatar nicolesigei avatar nokafor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

botframework-csharp-excelbot-rest-sample's Issues

Some browsers result in error message when trying to access workbook

Hi,

I implemented this example and have a sample file called Customer Data on a generic company profile's OneDrive. When I use the bot through WebChat, I get different results in different browsers. In Chrome, it works as expected and I can interact with the workbook. When I try to use Edge however, I run into the following error message when trying to open the workbook: Sorry, something went wrong when I tried to open the Customer Data workbook on your OneDrive for Business (String was not recognized as a valid DateTime.)
Another user experiences the above error when using Chrome, even though he is using the same generic company login that I do.
Below screenshot shows the different responses that I experience. On the left is using Edge, and on the right is Chrome.
capture

Any help would be greatly appreciated.

Thanks,
Pieter

LUIS import fails

The current ExceBot.json fails to import into LUIS with 'BadRequest': regex too complicated when any of the existing regex statements are present. When removing them the import runs fine.

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.