-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc475c8
commit 3c1080c
Showing
9 changed files
with
380 additions
and
0 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
copilot-studio/office-365-users-get-manager-topic/README.md
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,65 @@ | ||
# Office 365 Users: Get Manager | ||
|
||
This is a snippet that demonstrates how to get the manager of any user using the Office 365 Users connector inside of a Copilot Studio topic. | ||
|
||
![Office 365 Users: Get Manager topic in chat](./assets/office-365-users-get-manager-topic-chat.png) | ||
|
||
## Minimal path to awesome | ||
|
||
### Add the action | ||
|
||
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. Paste the contents of the **[YAML-file](./source/manager.yaml)** into the code editor | ||
1. Replace **{ REPLACE-WITH-CONNECTION-REFERENCE-NAME }** with the **connection reference name** you copied two steps earlier | ||
1. Now copy the first part of the **connection reference name**, up to the first period (.) | ||
|
||
![Internal name of Copilot](./assets/internal-name.png) | ||
|
||
This is the **internal name of your copilot**. You'll need it later. | ||
|
||
1. **Save** the action | ||
1. Select **Settings** | ||
1. Select **Generative AI** | ||
1. Scroll down to **How should your copilot decide how to respond?** and enable the **Generative** option | ||
1. Select **Save** | ||
1. Exit **Settings** by selecting the **X** in the upper right corner | ||
|
||
### Configure the topic | ||
|
||
1. Select **Topics** | ||
1. Select **+ Add a topic** | ||
1. Select **From blank** | ||
1. Name the topic **Get Manager Details** | ||
1. Select the **...** in the upper right corner and select **Open code editor** | ||
1. Paste the contents of the **[YAML-file](./source/topic.yaml)** into the code editor | ||
1. Replace all references of **{ REPLACE-WITH-INTERNAL-COPILOT-NAME }** with the **internal name of the copilot** you copied earlier (There are 4 references) | ||
1. Select **Save** | ||
|
||
You may see the following warning: | ||
|
||
![Warning](./assets/warning.png) | ||
|
||
Ignore this and select **Save**. There are no errors as long as you've replaced all references of the **internal name of the copilot** correctly | ||
|
||
To ensure that there are no errors, once the topic has been saved, select **Topic checker** and you should see the following: | ||
|
||
![Topic checker](./assets/topic-checker.png) | ||
|
||
1. Test out the copilot by asking **_"Who's my manager?"_** in the chat and follow the prompts. | ||
|
||
You should then get the following result (with your manager's name): | ||
|
||
![My manager result](./assets/my-manager-result.png) |
Binary file added
BIN
+71.3 KB
...-studio/office-365-users-get-manager-topic/assets/connection-reference-name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+67.8 KB
copilot-studio/office-365-users-get-manager-topic/assets/internal-name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+72.5 KB
copilot-studio/office-365-users-get-manager-topic/assets/my-manager-result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17.4 KB
...-365-users-get-manager-topic/assets/office-365-users-get-manager-topic-chat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+47.7 KB
copilot-studio/office-365-users-get-manager-topic/assets/topic-checker.png
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.
79 changes: 79 additions & 0 deletions
79
copilot-studio/office-365-users-get-manager-topic/source/manager.yaml
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,79 @@ | ||
kind: TaskDialog | ||
inputs: | ||
- kind: AutomaticTaskInput | ||
propertyName: id | ||
description: User principal name or id or email address | ||
entity: StringPrebuiltEntity | ||
|
||
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 | ||
|
||
triggerCondition: false |
236 changes: 236 additions & 0 deletions
236
copilot-studio/office-365-users-get-manager-topic/source/topic.yaml
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,236 @@ | ||
kind: AdaptiveDialog | ||
modelDescription: Gets the manager details of any user | ||
beginDialog: | ||
kind: OnRecognizedIntent | ||
id: main | ||
intent: {} | ||
actions: | ||
- kind: SendActivity | ||
id: sendActivity_mOFgma | ||
activity: Let's get those details for you 😊 | ||
|
||
- kind: Question | ||
id: question_4MfIos | ||
interruptionPolicy: | ||
allowInterruption: true | ||
|
||
variable: init:Topic.userChoice | ||
prompt: To confirm - are we trying to get the details of your manager or a colleague's manager? | ||
entity: | ||
kind: EmbeddedEntity | ||
definition: | ||
kind: ClosedListEntity | ||
items: | ||
- id: My manager | ||
displayName: My manager | ||
|
||
- id: My colleague's manager | ||
displayName: My colleague's manager | ||
|
||
- kind: ConditionGroup | ||
id: conditionGroup_WUd83N | ||
conditions: | ||
- id: conditionItem_IDEXaI | ||
condition: =Topic.userChoice = '{ REPLACE-WITH-INTERNAL-COPILOT-NAME }.topic.GetManagerDetails.main.question_4MfIos'.'My manager' | ||
actions: | ||
- kind: Question | ||
id: question_m3ehQc | ||
interruptionPolicy: | ||
allowInterruption: true | ||
|
||
variable: init:Topic.userEmail | ||
prompt: What's your email address? | ||
entity: StringPrebuiltEntity | ||
|
||
- kind: BeginDialog | ||
id: FttvwJ | ||
input: | ||
binding: | ||
id: =Topic.userEmail | ||
|
||
dialog: { REPLACE-WITH-INTERNAL-COPILOT-NAME }.component.Office365Users-GetmanagerV2 | ||
output: | ||
binding: | ||
aboutMe: Topic.aboutMe | ||
accountEnabled: Topic.accountEnabled | ||
birthday: Topic.birthday | ||
businessPhones: Topic.businessPhones | ||
city: Topic.city | ||
companyName: Topic.companyName | ||
country: Topic.country | ||
department: Topic.department | ||
displayName: Topic.displayName | ||
givenName: Topic.givenName | ||
hireDate: Topic.hireDate | ||
id: Topic.id | ||
interests: Topic.interests | ||
jobTitle: Topic.jobTitle | ||
mail: Topic.mail | ||
mailNickname: Topic.mailNickname | ||
mobilePhone: Topic.mobilePhone | ||
mySite: Topic.mySite | ||
officeLocation: Topic.officeLocation | ||
pastProjects: Topic.pastProjects | ||
postalCode: Topic.postalCode | ||
preferredLanguage: Topic.preferredLanguage | ||
preferredName: Topic.preferredName | ||
responsibilities: Topic.responsibilities | ||
schools: Topic.schools | ||
skills: Topic.skills | ||
state: Topic.state | ||
streetAddress: Topic.streetAddress | ||
surname: Topic.surname | ||
userPrincipalName: Topic.userPrincipalName | ||
userType: Topic.userType | ||
|
||
- kind: SendActivity | ||
id: sendActivity_ULgds4 | ||
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.displayName, | ||
wrap: true | ||
}, | ||
{ | ||
type: "TextBlock", | ||
spacing: "None", | ||
text: Topic.jobTitle, | ||
isSubtle: true, | ||
wrap: true | ||
} | ||
], | ||
width: "stretch" | ||
} | ||
] | ||
} | ||
], | ||
'$schema': "http://adaptivecards.io/schemas/adaptive-card.json", | ||
version: "1.3" | ||
} | ||
- id: conditionItem_zsm8vP | ||
condition: =Topic.userChoice = '{ REPLACE-WITH-INTERNAL-COPILOT-NAME }.topic.GetManagerDetails.main.question_4MfIos'.'My colleague''s manager' | ||
actions: | ||
- kind: Question | ||
id: question_EjT7mU | ||
interruptionPolicy: | ||
allowInterruption: true | ||
|
||
variable: init:Topic.colleagueName | ||
prompt: What is your colleague's name? | ||
entity: StringPrebuiltEntity | ||
|
||
- kind: Question | ||
id: question_AHWowM | ||
interruptionPolicy: | ||
allowInterruption: true | ||
|
||
variable: Topic.userEmail | ||
prompt: What's {Topic.colleagueName}'s email address? | ||
entity: StringPrebuiltEntity | ||
|
||
- kind: BeginDialog | ||
id: vvYdU0 | ||
input: | ||
binding: | ||
id: =Topic.userEmail | ||
|
||
dialog: { REPLACE-WITH-INTERNAL-COPILOT-NAME }.component.Office365Users-GetmanagerV2 | ||
output: | ||
binding: | ||
aboutMe: Topic.aboutMe | ||
accountEnabled: Topic.accountEnabled | ||
birthday: Topic.birthday | ||
businessPhones: Topic.businessPhones | ||
city: Topic.city | ||
companyName: Topic.companyName | ||
country: Topic.country | ||
department: Topic.department | ||
displayName: Topic.displayName | ||
givenName: Topic.givenName | ||
hireDate: Topic.hireDate | ||
id: Topic.id | ||
interests: Topic.interests | ||
jobTitle: Topic.jobTitle | ||
mail: Topic.mail | ||
mailNickname: Topic.mailNickname | ||
mobilePhone: Topic.mobilePhone | ||
mySite: Topic.mySite | ||
officeLocation: Topic.officeLocation | ||
pastProjects: Topic.pastProjects | ||
postalCode: Topic.postalCode | ||
preferredLanguage: Topic.preferredLanguage | ||
preferredName: Topic.preferredName | ||
responsibilities: Topic.responsibilities | ||
schools: Topic.schools | ||
skills: Topic.skills | ||
state: Topic.state | ||
streetAddress: Topic.streetAddress | ||
surname: Topic.surname | ||
userPrincipalName: Topic.userPrincipalName | ||
userType: Topic.userType | ||
|
||
- kind: SendActivity | ||
id: sendActivity_bLVv2l | ||
activity: | ||
attachments: | ||
- kind: AdaptiveCardTemplate | ||
cardContent: |- | ||
={ | ||
type: "AdaptiveCard", | ||
body: [ | ||
{ | ||
type: "TextBlock", | ||
text: Topic.colleagueName & "'s manager is", | ||
wrap: true | ||
}, | ||
{ | ||
type: "ColumnSet", | ||
columns: [ | ||
{ | ||
type: "Column", | ||
items: [ | ||
{ | ||
type: "TextBlock", | ||
weight: "Bolder", | ||
text: Topic.displayName, | ||
wrap: true | ||
}, | ||
{ | ||
type: "TextBlock", | ||
spacing: "None", | ||
text: Topic.jobTitle, | ||
isSubtle: true, | ||
wrap: true | ||
} | ||
], | ||
width: "stretch" | ||
} | ||
] | ||
} | ||
], | ||
'$schema': "http://adaptivecards.io/schemas/adaptive-card.json", | ||
version: "1.3" | ||
} | ||
elseActions: | ||
- kind: EndConversation | ||
id: rw5Xcc |