-
Notifications
You must be signed in to change notification settings - Fork 767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Multi Hub] Tab Calander- Nodejs Sample #837
Closed
Closed
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
8701d41
Initial code checkIn tab calendar
Harikrishnan-MSFT c55a595
Adding server tab calander samples
Harikrishnan-MSFT 5caa9fa
Update Code alignment
Harikrishnan-MSFT 0b4c204
Updating Reademe and images
Harikrishnan-MSFT 4357153
Updating Main Readme
Harikrishnan-MSFT 9d37404
Update Main Readme
Harikrishnan-MSFT 401e33c
Updating readme and add default page
Harikrishnan-MSFT 7986c92
Removing unwanted code
Harikrishnan-MSFT 1f523dd
Fixed PR comments
Harikrishnan-MSFT 008e921
Fixed PR Comments
Harikrishnan-MSFT cc16d2d
Updated PR comments
Harikrishnan-MSFT 67b29b8
Update README.md
ChetanSharma-msft 1a13548
Updating Readme
Harikrishnan-MSFT f5cb5cc
Merge branch 'v-harikrishnan/tab-calendar' of https://github.com/Offi…
Harikrishnan-MSFT 4b65841
Update README.md
ChetanSharma-msft 508e71a
Update README.md
ChetanSharma-msft baf6bf8
Update index.html
ChetanSharma-msft 6bc82d9
Update manifest.json
ChetanSharma-msft 5cc09b2
Update sample.json
ChetanSharma-msft 3d53b79
Update sample.json
ChetanSharma-msft 46b9a0e
Merge Email Profile concepts
Harikrishnan-MSFT aa834c2
Merge branch 'v-harikrishnan/tab-calendar' of https://github.com/Offi…
Harikrishnan-MSFT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
HTTPS=false | ||
BROWSER=none | ||
PORT=3978 | ||
REACT_APP_AZURE_APP_REGISTRATION_ID="{{REACT_APP_AZURE_APP_REGISTRATION_ID}}" | ||
REACT_APP_BASE_URL="{{REACT_APP_BASE_URL}}" | ||
REACT_APP_GRAPH_SCOPES=User.Read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.eslintcache | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.16/MicrosoftTeams.schema.json", | ||
"manifestVersion": "1.16", | ||
"version": "1.0.0", | ||
"id": "{{Microsoft-App-Id}}", | ||
"packageName": "com.teams.TabCalendar", | ||
ChetanSharma-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"developer": { | ||
"name": "Microsoft", | ||
"websiteUrl": "https://www.microsoft.com", | ||
"privacyUrl": "https://www.teams.com/privacy", | ||
"termsOfUseUrl": "https://www.teams.com/termsofuser" | ||
}, | ||
"icons": { | ||
"color": "color.png", | ||
"outline": "outline.png" | ||
}, | ||
"name": { | ||
"short": "Tab Calendar", | ||
"full": "Tab Calendar" | ||
}, | ||
"description": { | ||
"short": "Short description for Tab Calendar", | ||
ChetanSharma-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"full": "Full description of Interact with the user's calendar, including opening calendar items and composing meetings." | ||
ChetanSharma-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
"accentColor": "#5558AF", | ||
"staticTabs": [ | ||
{ | ||
"contentUrl": "https://{{domain-name}}/tab", | ||
"websiteUrl": "https://{{domain-name}}/tab", | ||
"entityId": "com.contoso.TabCalendar.help", | ||
ChetanSharma-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"name": "TabCalendar", | ||
"scopes": [ | ||
"personal" | ||
] | ||
} | ||
], | ||
"permissions": [ | ||
"identity", | ||
"messageTeamMembers" | ||
], | ||
"validDomains": [ | ||
"{{domain-name}}" | ||
], | ||
"webApplicationInfo": { | ||
"id": "{{Microsoft-App-Id}}", | ||
"resource": "api://{{domain-name}}/{{Microsoft-App-Id}}" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
--- | ||
page_type: sample | ||
description: This sample shows tab calendar in Outlook apps. | ||
ChetanSharma-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
products: | ||
- office-teams | ||
- office | ||
- office-365 | ||
languages: | ||
- typescript | ||
extensions: | ||
contentType: samples | ||
createdDate: "20/06/2023 01:38:27 PM" | ||
urlFragment: officedev-microsoft-teams-samples-tab-calendar-ts | ||
--- | ||
|
||
# Tab Calendar in Outlook | ||
ChetanSharma-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Interact with the user's calendar, including opening calendar items and composing meetings. | ||
ChetanSharma-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Included Features | ||
* Tabs | ||
ChetanSharma-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Interaction with app | ||
|
||
![Tab Personal QuickstartGif](Images/TabcalendarGif.gif) | ||
|
||
## Prerequisites | ||
- [NodeJS](https://nodejs.org/en/) | ||
|
||
- [M365 developer account](https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/prepare-your-o365-tenant) or access to a Teams account with the appropriate permissions to install an app. | ||
- [Ngrok](https://ngrok.com/download) (For local environment testing) Latest (any other tunneling software can also be used) | ||
|
||
- [Teams](https://teams.microsoft.com) Microsoft Teams is installed and you have an account | ||
|
||
## Register you app with Azure AD | ||
|
||
1. Register a new application in the [Azure Active Directory – App Registrations](https://go.microsoft.com/fwlink/?linkid=2083908) portal. | ||
2. Select **New Registration** and on the *register an application page*, set following values: | ||
* Set **name** to your app name. | ||
* Choose the **supported account types** (any account type will work) | ||
* Leave **Redirect URI** empty. | ||
* Choose **Register**. | ||
3. On the overview page, copy and save the **Application (client) ID, Directory (tenant) ID**. You’ll need those later when updating your Teams application manifest and in the .env. | ||
4. Under **Manage**, select **Expose an API**. | ||
5. Select the **Set** link to generate the Application ID URI in the form of `api://{base-url}/{AppID}`. Insert your fully qualified domain name (with a forward slash "/" appended to the end) between the double forward slashes and the GUID. The entire ID should have the form of: `api://fully-qualified-domain-name/{AppID}` | ||
* ex: `api://%ngrokDomain%.ngrok-free.app/00000000-0000-0000-0000-000000000000`. | ||
6. Select the **Add a scope** button. In the panel that opens, enter `access_as_user` as the **Scope name**. | ||
7. Set **Who can consent?** to `Admins and users` | ||
8. Fill in the fields for configuring the admin and user consent prompts with values that are appropriate for the `access_as_user` scope: | ||
* **Admin consent title:** Teams can access the user’s profile. | ||
* **Admin consent description**: Allows Teams to call the app’s web APIs as the current user. | ||
* **User consent title**: Teams can access the user profile and make requests on the user's behalf. | ||
* **User consent description:** Enable Teams to call this app’s APIs with the same rights as the user. | ||
9. Ensure that **State** is set to **Enabled** | ||
10. Select **Add scope** | ||
* The domain part of the **Scope name** displayed just below the text field should automatically match the **Application ID** URI set in the previous step, with `/access_as_user` appended to the end: | ||
* `api://[ngrokDomain].ngrok-free.app/00000000-0000-0000-0000-000000000000/access_as_user. | ||
11. In the **Authorized client applications** section, identify the applications that you want to authorize for your app’s web application. Each of the following IDs needs to be entered: | ||
* `4765445b-32c6-49b0-83e6-1d93765276ca` (Office web) | ||
* `0ec893e0-5785-4de6-99da-4ed124e5296c` (Office desktop) | ||
* `bc59ab01-8403-45c6-8796-ac3ef710b3e3` (Outlook web) | ||
* `d3590ed6-52b3-4102-aeff-aad2292ab01c` (Outlook desktop) | ||
12. Navigate to **API Permissions**, and make sure to add the follow permissions: | ||
- Select Add a permission | ||
- Select Microsoft Graph -\> Delegated permissions. | ||
- `User.Read` (enabled by default) | ||
- `Calendars.Read` | ||
- `Calendars.ReadBasic` | ||
- `Calendars.ReadWrite` | ||
- Click on Add permissions. Please make sure to grant the admin consent for the required permissions. | ||
13. Navigate to **Authentication** | ||
If an app hasn't been granted IT admin consent, users will have to provide consent the first time they use an app. | ||
- Set a redirect URI: | ||
* Select **Add a platform**. | ||
* Select **Single-page application**. | ||
* Enter the **redirect URI** for the app in the following format: `https://{Base_Url}/auth-end`. | ||
14. Navigate to the **Certificates & secrets**. In the Client secrets section, click on "+ New client secret". Add a description(Name of the secret) for the secret and select “Never” for Expires. Click "Add". Once the client secret is created, copy its value, it need to be placed in the .env. | ||
|
||
2. Setup NGROK | ||
- Run ngrok - point to port 3978 | ||
|
||
```bash | ||
ngrok http 3978 --host-header="localhost:3978" | ||
``` | ||
3. Setup for code | ||
Clone the repository | ||
|
||
```bash | ||
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git | ||
``` | ||
|
||
4. Open .env file from this path folder `samples/tab-calendar/ts/api-server` and update | ||
- `{{CLIENT_ID}}` - Generated from Step 1 (Application (client) ID)is the application app id | ||
- `{{CLIENT_SECRET}}` - Generated from Step 1.14, also referred to as Client secret | ||
|
||
5. Open .env file from this path folder `samples/tab-calendar/ts` and update | ||
- `{{REACT_APP_AZURE_APP_REGISTRATION_ID}}` - Generated from Step 1 (Application (client) ID)is the application app id | ||
- `{{REACT_APP_BASE_URL}}` - Your application's base url. E.g. https://12345.ngrok-free.app if you are using ngrok. | ||
|
||
6. We have two different solutions to run, so follow below steps: | ||
|
||
- In a terminal, navigate to `samples/tab-calendar/ts/api-server` folder, Open your local terminal and run the below command to install node modules. You can do the same in Visual studio code terminal by opening the project in Visual studio code | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
```bash | ||
npm start | ||
``` | ||
- The server will start running on 5000 port | ||
|
||
- In a different terminal, navigate to `samples/tab-calendar/ts` folder, Open your local terminal and run the below command to install node modules. You can do the same in Visual studio code terminal by opening the project in Visual studio code | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
```bash | ||
npm start | ||
``` | ||
- The client will start running on 3978 port | ||
|
||
4. Setup Manifest for Teams | ||
|
||
ChetanSharma-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- **This step is specific to Teams.** | ||
**Edit** the `manifest.json` contained in the `Manifest/` folder to replace with your MicrosoftAppId (that was created in step1.1 and is the same value of MicrosoftAppId in `.env` file) *everywhere* you see the place holder string `{{Microsoft-App-Id}}` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`) | ||
**Edit** the `manifest.json` for `validDomains` and replace `{{domain-name}}` with base Url of your domain. E.g. if you are using ngrok it would be `https://1234.ngrok-free.app` then your domain-name will be `1234.ngrok-free.app`. | ||
**Zip** up the contents of the `Manifest/` folder to create a `manifest.zip` or `Manifest_Hub/` folder to create a `manifest_Hub.zip` | ||
**Upload** the `manifest.zip` to Teams (in the left-bottom *Apps* view, click "Upload a custom app") | ||
|
||
## Running the sample | ||
|
||
**Install App:** | ||
|
||
![InstallApp](Images/Install.png) | ||
|
||
**On the side bar, select More Apps. Your sideloaded app title appears among your installed apps:** | ||
|
||
![AppOutlook](Images/AppOutlook.png) | ||
|
||
**Select your app icon to launch and preview your app running in Outlook on the desktop:** | ||
|
||
![HomeScreen](Images/HomeScreen.png) | ||
|
||
**Add Details for Compose Meeting:** | ||
|
||
![EnterComposeMeeting](Images/EnterComposeMeeting.png) | ||
|
||
**Click ComposeMeeting:** | ||
|
||
![ClickComposeMeeting](Images/ClickComposeMeeting.png) | ||
|
||
**Click View:** | ||
|
||
![ClickView](Images/ClickView.png) | ||
|
||
## Further Reading. | ||
[Calendar Module](https://learn.microsoft.com/en-us/javascript/api/@microsoft/teams-js/calendar?view=msteams-client-js-latest) | ||
ChetanSharma-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
<img src="https://pnptelemetry.azurewebsites.net/microsoft-teams-samples/samples/tab-calendar-ts" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CLIENT_ID="{{CLIENT_ID}}" | ||
CLIENT_SECRET="{{CLIENT_SECRET}}" | ||
GRAPH_SCOPES=User.Read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const esbuild = require('esbuild'); | ||
esbuild.build({ | ||
entryPoints: ['server.js'], | ||
bundle: true, | ||
platform: 'node', | ||
outfile: 'dist/index.js' | ||
}) | ||
.then((r) => { | ||
console.log(`Build succeeded.`); | ||
}) | ||
.catch((e) => { | ||
console.log("Error building:", e.message); | ||
process.exit(1); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to create deploy pipeline.