Git Product home page Git Product logo

contoso-airlines-teams-sample's Introduction

Contoso Airlines sample for Microsoft Teams Graph APIs

This sample demonstrates using the Microsoft Graph APIs for Microsoft teams to automate team lifecycles for Contoso Airlines: every night, they create a new team for each flight they are flying the following day, and after the flight, they archive the team.

Build and run

To run, you'll need to register your application.

  1. Sign into the Azure app registration portal using either your personal or work or school account.

  2. Choose New registration near the top.

  3. Enter a name for the app. Under Supported account types, select Accounts in any organizational directory and personal Microsoft accounts (e.g. Skype, Xbox, Outlook.com).

  4. For Redirect URI (optional), choose Web and then enter http://localhost:55065/.

    The app overview page displays, listing the properties of your app.

  5. Copy the value for Application (client) ID. This is the unique identifier for your app.

  6. Select the Certificated & secrets page. Under Client secrets, choose New client secret.

  7. Enter a label for the client secret and select an expiration period. Select Add.

  8. Copy the value for your new client secret. This is the only time you will be able to see this value.

    You'll use the application ID and secret to configure the sample app in the next section.

  9. Navigate to the Authentication page.

  10. Under Advanced settings, find the Implicit grant section. Check the boxes for Access tokens and ID tokens to enable implicit flow.

    These options enable the hybrid flow. 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.

  11. Choose Save at the top.

  12. Create a file named Web.config.secrets (put it next to Web.config), and add in your application ID and client (app) secret:

<?xml version="1.0" encoding="utf-8"?>
  <appSettings >
    <add key="ida:AppId" value="xxxxx"/>
    <add key="ida:AppSecret" value="xxxxx"/>
  </appSettings>

Code of note

Note: To understand the code for calling the Microsoft Graph API in an ASP.NET MVC app, see Get started with Microsoft Graph in an ASP.NET 4.6 MVC app.

A lot of this code came from the Graph Quickstart for ASP.NET MVC.

Questions and comments

We'd love to get your feedback about this sample. You can send us your questions and suggestions in the Issues section of this repository.

Your feedback is important to us. Connect with us on Stack Overflow. Tag your questions with [MicrosoftGraph].

Contributing

If you'd like to contribute to this sample, see CONTRIBUTING.md.

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.

Additional resources

Copyright

Copyright (c) 2018 Microsoft. All rights reserved.

contoso-airlines-teams-sample's People

Contributors

jackson-woods avatar jthake avatar nkramer 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contoso-airlines-teams-sample's Issues

Authorization_IdentityNotFound Error

Hi I keep getting the Authorization_IdentityNotFound Error when I try to run the application from Visual Studio. I registered my app on the azure portal, added in all the graph permissions (and got admin consent) and added a secrets file as stated on the readme? Do I have to do something with get the authentication token? I am using an office 365 developer account.

Thanks,
Ryan

MS Teams Notifications Clarifications

Hi Team,

We have a requirement of sending notifications on MS teams. Need your help in understanding the approach of installing bot app forcefully for all the users in MS Teams app client and store the conversation reference.

Installing Teams App Queries:

  1. As per the below guide, we can install teams app using Graph API to the users. Looks like the API is in beta version ? Can you help if we can raise with engineering team by when we can expect the API's will be made public ?
    https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/conversations/send-proactive-messages?tabs=dotnet#obtain-necessary-user-information
  2. Though the capability exists for querying if the app is already installed for a user, how can we make sure those users are not impacted with this update ? What are the best practices on this ? Please suggest.
    https://docs.microsoft.com/en-us/graph/teams-proactive-messaging#install-the-app-for-your-users
  3. As a best practice, it is suggested to run this installation API in batches, what are the best ways to handle rate limiting considering a larger organization ?
    https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/rate-limit

Notifications Queries:

  1. MS Teams can send notifications using either unique id of user in teams or using the chatThreadId while sending a welcome message. Considering welcome message and any other custom notifications if Bot has to trigger, What are the limitations of sending notifications to users on MS Teams. Please suggest.
  2. Can we Azure notifications hub for this implementation ?

Please help clarifying the above.

Bad Request while trying to create a group

Hello,

I get the following error when trying to create a group based on your code. Users and Group information seem to be fine.

responseBody: "see: ...can only be present once as an add/remove change"

"{\r\n \"error\": {\r\n \"code\": \"Request_BadRequest\",\r\n \"message\": \"Object '[ResourceType=User,Id=7xb299a1-7a5c-4428-ad36-2fbf5407ffeg,ChangedProperties=[],NonDefaultProperties=[INTERNAL_SingleResourceQuery]]' referenced from '[ResourceType=Group,Id=62727b72-49a1-45bd-9570-6677ac87e62n,ChangedProperties=[Description,DisplayName,GroupType,MailEnabled,MailNickname,SecurityEnabled,IsPublic],NonDefaultProperties=[INTERNAL_EnableF14M1SchemaEnumTypes,visibility]]' can only be present once as an add/remove change.\",\r\n \"innerError\": {\r\n \"request-id\": \"715e7a45-c5d2-4e34-be96-7d702ae6791b\",\r\n \"date\": \"2018-12-17T10:14:23\"\r\n }\r\n }\r\n}"

How can I fix this?

UPDATE

I found it: The user was added twice as group member - commenting it fixed it:

crew = new string[] {
                $"morgenstern@{tenantName}",
                //$"admin@{tenantName}",
            };

Add members to private channels

Hi,
this is not an issue but a question, is it possible to add members to private channels using Graph, after the channel is created.

The sample does not create a team.

When I run the sample, after deploying it on Azure, I get an error stating

"An Error Occured whiile processing your request"

When I watch the console window, I see the following message

" Exception thrown: 'System.Exception' in Microsoft Graph SDK ASPNET Connect.dll"

Invalid client secret is provided

I try to install the web sample and modify de web.config.secrets with de application id and the

But when i run the application this is de error message.
AADSTS7000215: Invalid client secret is provided. Trace ID: 02f6f1c8-78b8-44f9-9576-66a55b4aa100 Correlation ID: 52f513ad-39d9-4eb4-b1a9-281571228968 Timestamp: 2021-09-13 23:21:24Z

Can you tell me what is wrong.

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.