GithubHelp home page GithubHelp logo

dineshreddynaredla / csharp-teams-sample-graph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoftgraph/csharp-teams-sample-graph

0.0 1.0 0.0 764 KB

Sample apps (C# and node) for accessing Microsoft Teams data via the Microsoft Graph

License: Creative Commons Attribution 4.0 International

JavaScript 50.75% HTML 5.34% C# 43.36% CSS 0.53% ASP 0.03%

csharp-teams-sample-graph's Introduction

page_type products languages extensions
sample
office-teams
ms-graph
csharp
contentType technologies services createdDate
samples
Microsoft Graph
Microsoft Teams
5/30/2017 6:00:04 PM

Microsoft Teams Graph API Samples

This sample has example calls to many of the Teams Graph APIs, including:

  • Get My Teams
  • Get Channels
  • Get Apps
  • Create Channel
  • Post Message
  • Create Team and Group
  • Add Team to Group
  • Add Member to team
  • Update Team settings

Related samples

For more information on developing apps for Microsoft Teams, please review the Microsoft Teams developer documentation.**

Prerequisites

O365 Account with Admin privileges

To set this app up, you'll need to be a global admin, because only global admins can consent to apps using permissions such as Group.ReadWrite.All. Consider creating your own test tenant by creating a developer account with our Office 365 Developer program.

Registered app

You'll need to register an app through the following process:

  1. Sign in to the Azure portal using either a work or school account or a personal Microsoft account.

  2. If your account gives you access to more than one tenant, select your account in the top right corner, and set your portal session to the Azure AD tenant that you want.

  3. Select New registration.

  4. When the Register an application page appears, enter your application's registration information:

    • Name - Enter a meaningful application name that will be displayed to users of the app.
    • Supported account types - Select which accounts you would like your application to support.
    • Redirect URI (optional) - Select Web and enter 'http://localhost:55065/' for the Redirect URI.
  5. When finished, select Register.

  6. Azure AD assigns a unique application (client) ID to your app, and you're taken to your application's Overview page. To add additional capabilities to your application, you can select other configuration options including branding, certificates and secrets, API permissions, and more.

    Copy the Application Id. This is the unique identifier for your app.

  7. Under Manage on the left-hand pane, click Certificates & secrets. Under Client secrets, click New client secret. Enter a description and an expiration, then click Add. This creates a secret string, or application password, which the application uses to prove it's identity.

    Copy the value from the new secret.

  8. Under Manage on the left-hand pane, click Authentication. Under Implicit grant, check Access tokens and ID tokens. During authentication, this enables the app to receive both sign-in info (the id_token) and artifacts (in this case, an authorization code) that the app can use to obtain an access token. Save your changes.

  9. Under Manage on the left-hand pane, click API permissions and then Add a new permission. Select Microsoft Graph and then Delegated permissions. Add 'Group.ReadWrite.All' (Read and write all groups) and 'User.ReadWrite.All' (Read and write all users' full profile) permissions. Click Add a new permission again then Application permissions. Add 'Group.ReadWrite.All' (Read and write all groups) and 'User.ReadWrite.All' (Read and write all users' full profile) permissions.

See the individual project readmes for more information.

Build and run the sample app

  1. Open the sample solution in Visual Studio.
  2. Get your appid & app secret from the previous section
  3. Create a file named Web.config.secrets (put it next to Web.config), and add in your appid and app secret:
<?xml version="1.0" encoding="utf-8"?>
  <appSettings >
    <add key="ida:AppId" value="xxxxx"/>
    <add key="ida:AppSecret" value="xxxxx"/>
  </appSettings>
  1. Update the 'Web Server' of your web application with the 'ida:RedirectUri' of your registered app
  • In Solution Explorer, right-click the name of the Web application project for which you want to specify a Web server, and then click 'Properties'.
  • In the 'Properties' window, click the 'Web' tab.
  • Under 'Servers', update the 'Project Url' with the 'ida:RedirectUri' of your registered app.
  • Click 'Create Virtual Directory'
  • Save the file.
  1. Build and run the sample.

  2. Sign in with your account, and grant the requested permissions.

  • Note you'll need to have appropriate elevated rights to run the app (Group.ReadWrite.All and User.ReadWrite.All)
  1. Choose operation, such as 'Get My Teams', 'Get Channels', 'Create Channel' or 'Post Message'.

  2. Response information is displayed at the bottom of the page.

Feedback

We welcome your feedback! Here's how to send us yours.

Microsoft Open Source Code of Conduct

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.

Contributing

Please read Contributing for details on the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the License file for details.

Copyright

Copyright (c) 2018 Microsoft Corporation. All rights reserved.

csharp-teams-sample-graph's People

Contributors

btastic avatar davidchesnut avatar jackson-woods avatar jmprieur avatar microsoftopensource avatar msftgits avatar nkramer avatar nokafor avatar o365devx avatar richardtaylorrt avatar richmoemsft avatar rwike77 avatar sunilk-iitkgp avatar

Watchers

 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.