Skip to content
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

office-365-users-get-manager-ac (update) #32

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions copilot-studio/office-365-users-get-manager-ac/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Office 365 Users: Get Manager (Action with Adaptive Card)

This is a snippet that demonstrates how to get your manager details using the Office 365 Users action. It uses an adaptive card as an output to not only display your manager details but to also start a Teams chat with them.

![Office 365 Users: Get Manager Action example](./assets/manager-action-example.png)

You can also customize the adaptive card to include more information from your manager.

## Authors

Snippet|Author(s)
--------|---------
Office 365 Users: Get Manager (Action with Adaptive Card) | [Gomolemo Mohapi](https://github.com/gomomohapi) ([@GomoMohapi](https://www.twitter.com/GomoMohapi))

## Minimal path to awesome

1. Open a copilot in **Copilot Studio**
1. Select **Actions**
1. Select **+ Add an action**
1. Search for **Get manager** and press _Enter_
1. Select the **Get manager (V2)** action from the **Office 365 Users** connector
1. Select **Next**
1. Select **Next** again
1. Select **Finish**
1. Select the **Office 365 Users - Get manager (V2)** action in the list (select the name)
1. Select the **...** in the upper right corner and select **Open code editor**
1. Make sure to look for and copy the **name** of the **connection reference**

![Connection reference name](./assets/connection-reference-name.png)

1. Replace all the code in the code editor with the contents of this **[YAML-file](./source/manager.yaml)**

1. Replace **{ REPLACE-WITH-CONNECTION-REFERENCE-NAME }** with the **connection reference name** you copied two steps earlier

1. **Save** the action.

1. Select **Settings** on the top right corner

1. Select **Generative AI**

1. Under **Using generative AI in conversations**, select **Generative**

1. Select **Save** and then exit **Settings** by selecting the **X** in the upper right corner

1. Open the **Test your copilot** panel

1. **Refresh** the **Test your copilot** panel to get the latest changes

1. Test out the action by asking `get my manager` or something similar:

![Office 365 Users: Get Manager Action example](./assets/manager-action-example.png)

## Disclaimer

**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

<img src="https://m365-visitor-stats.azurewebsites.net/powerplatform-snippets/copilot-studio/office-365-users-get-manager-ac" aria-hidden="true" />








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.
129 changes: 129 additions & 0 deletions copilot-studio/office-365-users-get-manager-ac/source/manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
kind: TaskDialog
inputs:
- kind: ManualTaskInput
propertyName: id
value: =System.User.PrincipalName

outputs:
- propertyName: aboutMe

- propertyName: accountEnabled

- propertyName: birthday

- propertyName: businessPhones

- propertyName: city

- propertyName: companyName

- propertyName: country

- propertyName: department

- propertyName: displayName

- propertyName: givenName

- propertyName: hireDate

- propertyName: id

- propertyName: interests

- propertyName: jobTitle

- propertyName: mail

- propertyName: mailNickname

- propertyName: mobilePhone

- propertyName: mySite

- propertyName: officeLocation

- propertyName: pastProjects

- propertyName: postalCode

- propertyName: preferredLanguage

- propertyName: preferredName

- propertyName: responsibilities

- propertyName: schools

- propertyName: skills

- propertyName: state

- propertyName: streetAddress

- propertyName: surname

- propertyName: userPrincipalName

- propertyName: userType

action:
kind: InvokeConnectorTaskAction
connectionReference: { REPLACE-WITH-CONNECTION-REFERENCE-NAME }
connectionProperties:
mode: Invoker

operationId: Manager_V2

response:
activity:
attachments:
- kind: AdaptiveCardTemplate
cardContent: |-
={
type: "AdaptiveCard",
body: [
{
type: "TextBlock",
text: "Your manager is",
wrap: true
},
{
type: "ColumnSet",
columns: [
{
type: "Column",
items: [
{
type: "TextBlock",
weight: "Bolder",
text: Topic.Output.displayName,
wrap: true
},
{
type: "TextBlock",
spacing: "None",
text: Topic.Output.jobTitle,
isSubtle: true,
wrap: true
}
],
width: "stretch"
}
]
}
],
actions: [
{
type: "Action.OpenUrl",
title: $"💬 Start a Teams chat with {Topic.Output.givenName}",
url: $"https://teams.microsoft.com/l/chat/0/0?users={Topic.Output.mail}"
}
],
'$schema': "http://adaptivecards.io/schemas/adaptive-card.json",
version: "1.3"
}

mode: Strict

outputMode: Specific
Loading