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

Add Analyze Emails New Sample #207

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
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
120 changes: 120 additions & 0 deletions samples/Analyze Emails/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# AnalyzeEmails

## Summary

Sample Solution to analyze the sentiment of emails located in Feedback folder and respond to them using AI Builder.

![demo of the sample](assets/application-demo.gif)

### Screen 1 - Browse Emails

![demo of the sample](assets/application-ui1.png)

### Screen 2 - Detailed View

![demo of the sample](assets/application-ui2.png)

### Screen 3 - Respond to Email

![demo of the sample](assets/application-ui3.png)

## Applies to

* [Microsoft Power Apps](https://docs.microsoft.com/powerapps/)

## Compatibility

![Power Apps Source File Pack and Unpack Utility 0.20](https://img.shields.io/badge/Packing%20Tool-0.20-green.svg)
![Premium License](https://img.shields.io/badge/Premium%20License-Required-green.svg "Premium Power Apps license not required")
![Experimental Features](https://img.shields.io/badge/Experimental%20Features-No-green.svg "Does not rely on experimental features")
![On-Premises Connectors](https://img.shields.io/badge/On--Premises%20Connectors-No-green.svg "Does not use on-premise connectors")
![Custom Connectors](https://img.shields.io/badge/Custom%20Connectors-Not%20Required-green.svg "Does not use custom connectors")

## Authors

Solution|Author(s)
--------|---------
Analyze Emails | [John Aziz](https://github.com/john0isaac) ([@john00isaac](https://twitter.com/john00isaac)), Gold Microsoft Learn Student Ambassador

## Version history

Version|Date|Comments
-------|----|--------
1.0|July 25, 2023|Initial release

## Features

This sample illustrates the following concepts:

* Get unread emails from Outlook using the Office 365 Connector.
* Integrate AI Builder to analyze the Sentiment of emails.
* Filter the emails based on their sentiment.
* Respond to an email from Power Apps.
* Mark an email as read to hide it from Power Apps.

## Prerequisites

* Create a Folder for the emails you want to analyze inside your Outlook and Add Emails to it.
* For the solution to work the folder must be named "Feedback". (Learn more: [here](https://support.microsoft.com/en-us/office/organize-email-by-using-folders-0616c259-4bc1-4f35-807d-61eb59ac79c1))

## Solution Components

The following solution components are used in this sample:

* Analyze Emails (Canvas app)
* SentimentAnalysis model (AI Model)
* Office 365 Outlook (Connection reference)

## Data Sources

No datasource needed.

## Minimal Path to Awesome

* [Download](./solution/AIBuilderPowerAppsAnalyzeEmailsmSample_1_0_0_0.zip) the solution `.zip` from the `solution` folder
* Within **[make.powerapps.com](https://make.powerapps.com)**, import the `.zip` file via **Solutions** > **Import solution** > **Browse** and select the `.zip` file you just downloaded.
* Click next.
* Click on the **Solution Display Name** to open it.
* Click on the **Canvas App** to Open the application in edit mode.
* Click **Allow** to give the Power App permission to access your Outlook emails.
* Click on the **Play** button to test the App.

## Using the Source Code

You can also use the [Power Apps CLI](https://aka.ms/pac/docs) to pack the source code by following these steps::

* Clone the repository to a local drive
* Pack the source files back into `.zip` file:

```bash
pac solution pack --folder pathtosourcefolder --zipfile pathtosolution --processCanvasApps
```

Making sure to replace `pathtosourcefolder` to point to the path to this sample's `sourcecode` folder, and `pathtosolution` to point to the path of this solution's `.zip` file (located under the `solution` folder)
* Within **[make.powerapps.com](https://make.powerapps.com)**, import the `.zip` file via **Solutions** > **Import solution** > **Browse** and select the `.zip` file you just downloaded.
* Click next.
* Click on the **Solution Display Name** to open it.
* Click on the **Canvas App** to Open the application in edit mode.
* Click **Allow** to give the Power App permission to access your Outlook emails.
* Click on the **Play** button to test the App.

## 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.**

## Help

We do not support samples, but we this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.

If you encounter any issues while using this sample, you can [create a new issue](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=bug-report.yml&sample=YOURSAMPLENAME&authors=@YOURGITHUBUSERNAME&title=YOURSAMPLENAME%20-%20).

For questions regarding this sample, [create a new question](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=question.yml&sample=YOURSAMPLENAME&authors=@YOURGITHUBUSERNAME&title=YOURSAMPLENAME%20-%20).

Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/powerapps-samples/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected&template=suggestion.yml&sample=YOURSAMPLENAME&authors=@YOURGITHUBUSERNAME&title=YOURSAMPLENAME%20-%20).

## For more information

* [Overview of creating apps in Power Apps](https://docs.microsoft.com/powerapps/maker/)
* [Power Apps canvas apps documentation](https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/)

<img src="https://telemetry.sharepointpnp.com/powerapps-samples/samples/readme-template" />
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.
8 changes: 8 additions & 0 deletions samples/Analyze Emails/sourcecode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# msbuild output directories
/bin
/obj

# MSBuild Binary and Structured Log
*.binlog
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PowerAppsTargetsPath>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\PowerApps</PowerAppsTargetsPath>
</PropertyGroup>

<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.props" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.props')" />

<PropertyGroup>
<ProjectGuid>a464aaaf-d951-4aac-99bc-779b6286ace7</ProjectGuid>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<!--Remove TargetFramework when this is available in 16.1-->
<TargetFramework>net462</TargetFramework>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
<SolutionRootPath>src</SolutionRootPath>
</PropertyGroup>

<!--
Solution Packager overrides, un-comment to use: SolutionPackagerType (Managed, Unmanaged, Both)
Solution Localization Control, if you want to enabled localization of your solution, un-comment SolutionPackageEnableLocalization and set the value to true. - Requires use of -loc flag on Solution Clone or Sync
-->
<!--
<PropertyGroup>
<SolutionPackageType>Managed</SolutionPackageType>
<SolutionPackageEnableLocalization>false</SolutionPackageEnableLocalization>
</PropertyGroup>
-->

<ItemGroup>
<PackageReference Include="Microsoft.PowerApps.MSBuild.Solution" Version="1.*" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\.gitignore" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\bin\**" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\obj\**" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.cdsproj" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.cdsproj.user" />
<ExcludeDirectories Include="$(MSBuildThisFileDirectory)\*.sln" />
</ItemGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\**" Exclude="@(ExcludeDirectories)" />
<Content Include="$(SolutionPackageZipFilePath)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<Import Project="$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.targets" Condition="Exists('$(PowerAppsTargetsPath)\Microsoft.PowerApps.VisualStudio.Solution.targets')" />

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<CanvasApp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Name>new_analyzeemails_978d2</Name>
<AppVersion>2023-07-24T22:33:51Z</AppVersion>
<Status>Ready</Status>
<CreatedByClientVersion>3.23071.17.0</CreatedByClientVersion>
<MinClientVersion>3.23071.17.0</MinClientVersion>
<Tags>{"primaryDeviceWidth":"1366","primaryDeviceHeight":"768","supportsPortrait":"true","supportsLandscape":"true","primaryFormFactor":"Tablet","publisherVersion":"3.23071.17","minimumRequiredApiVersion":"2.2.0","hasComponent":"false","hasUnlockedComponent":"false","isUnifiedRootApp":"false","sienaVersion":"20230714T180119Z-3.23064.16.0"}</Tags>
<IsCdsUpgraded>0</IsCdsUpgraded>
<GalleryItemId xsi:nil="true"></GalleryItemId>
<BackgroundColor>rgba(56, 96, 178, 1)</BackgroundColor>
<DisplayName>Analyze Emails</DisplayName>
<Description>Sample Power App analyzes the sentiment of emails located in Feedback folder using AI Builder.</Description>
<CommitMessage xsi:nil="true"></CommitMessage>
<Publisher xsi:nil="true"></Publisher>
<AuthorizationReferences>[]</AuthorizationReferences>
<ConnectionReferences>{"25fcc947-df7c-4e8d-80a1-50422e8ffb57":{"id":"/providers/microsoft.powerapps/apis/shared_office365","displayName":"Office 365 Outlook","iconUri":"https://connectoricons-prod.azureedge.net/u/laborbol/partial-builds/390724148/1.0.1641.3327/office365/icon.png","dataSources":["Office365Outlook"],"dependencies":[],"dependents":[],"parameterHints":{},"parameterHintsV2":{},"isOnPremiseConnection":false,"bypassConsent":false,"dataSets":{},"apiTier":"Standard","actions":["GetEmails","MarkAsRead_V3","ReplyTo"]}}</ConnectionReferences>
<DatabaseReferences>{"default.cds":{"databaseDetails":{"referenceType":"Environmental","environmentName":"default.cds","overrideValues":{"status":"NotSpecified"}},"dataSources":{"43b0dc67-68af-47ae-9a9c-9e69d396ba3e":{"entitySetName":"msdyn_aimodels","logicalName":"msdyn_aimodel"}},"components":[{"componentName":"msdyn_AIModel","identifier":"f1c549c2-a97e-47a5-b612-c5c2bab0f163","identifierType":"UniqueId"}]}}</DatabaseReferences>
<AppComponents>[]</AppComponents>
<AppComponentDependencies>[]</AppComponentDependencies>
<CanConsumeAppPass>1</CanConsumeAppPass>
<CanvasAppType>0</CanvasAppType>
<BypassConsent>0</BypassConsent>
<AdminControlBypassConsent>0</AdminControlBypassConsent>
<EmbeddedApp xsi:nil="true"></EmbeddedApp>
<IntroducedVersion>1.0</IntroducedVersion>
<CdsDependencies>{"cdsdependencies":[{"logicalname":"msdyn_aimodel","componenttype":1},{"dependencyid":"f1c549c2-a97e-47a5-b612-c5c2bab0f163","logicalname":"","componenttype":401,"componenttypeplatformname":"msdyn_AIModel"}]}</CdsDependencies>
<IsCustomizable>1</IsCustomizable>
<BackgroundImageUri>/CanvasApps/new_analyzeemails_978d2_BackgroundImageUri</BackgroundImageUri>
<DocumentUri>/CanvasApps/new_analyzeemails_978d2_DocumentUri.msapp</DocumentUri>
</CanvasApp>
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Content": "Image",
"FileName": "/ctrllib/image/images/SampleImage.svg",
"IsSampleData": true,
"IsWritable": false,
"Name": "SampleImage",
"Path": "/ctrllib/image/images/SampleImage.svg",
"ResourceKind": "Uri",
"RootPath": "ms-appx:///ctrllib/image/images/SampleImage.svg",
"Schema": "i",
"Type": "ResourceInfo"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"FormatVersion": "0.24",
"Header": {
"DocVersion": "1.333",
"MinVersionToLoad": "1.331",
"MSAppStructureVersion": "2.0"
},
"Properties": {
"AppCreationSource": "AppFromScratch",
"AppDescription": "Sample Power App analyzes the sentiment of emails located in Feedback folder using AI Builder.",
"AppPreviewFlagsMap": {
"aibuilderserviceenrollment": false,
"allowmultiplescreensincanvaspages": false,
"appinsightserrortracing": false,
"appinstrumentationcorrelationtracing": false,
"asyncnodedelegation": true,
"autocreateenvironmentvariables": false,
"backfromhostaction": false,
"behaviorpropertyui": false,
"blockmovingcontrol": true,
"cdsdataformatting": false,
"classiccontrols": false,
"consistentreturnschemafortabularfunctions": true,
"copyandmerge": false,
"datatablev2control": true,
"dataverseactionsenabled": true,
"delaycontrolrendering": true,
"delayloadscreens": true,
"disablecdsfileandlargeimage": false,
"dynamicschema": false,
"enableappembeddingux": false,
"enablechatbotfeature": false,
"enablecomponentnamemaps": false,
"enablecomponentscopeoldbehavior": false,
"enablecopilotcontrol": false,
"enabledataverseoffline": false,
"enableeditcacherefreshfrequency": false,
"enableexcelonlinebusinessv2connector": true,
"enableexperimentaldataverseoffline": false,
"enableideaspanel": true,
"enablelegacybarcodescanner": false,
"enableonstart": true,
"enableonstartnavigate": false,
"enablepcfmoderndatasets": true,
"enablerowscopeonetonexpand": false,
"enablerpawarecomponentdependency": true,
"enablerulespanel": false,
"enableruntimepolicies": true,
"enablesaveloadcleardataonweb": false,
"enableupdateifdelegation": false,
"enhanceddelegation": true,
"enhancedgalleryinitialization": true,
"errorhandling": true,
"excelcompatibility": false,
"expandedsavedatasupport": true,
"exportimportcomponents2": true,
"externalmessage": false,
"fluentv9controls": false,
"fluentv9controlspreview": false,
"formuladataprefetch": true,
"formularepair": false,
"generatedebugpublishedapp": false,
"herocontrols": false,
"improvedmediacapture": false,
"improvedtabstopbehavior": false,
"impurenodedelegation": true,
"isemptyrequirestableargument": true,
"keeprecentscreensloaded": false,
"longlivingcache": false,
"mobilenativerendering": false,
"namedformulas": true,
"nativecdsexperimental": true,
"onegrid": false,
"optimizedforteamsmeeting": false,
"packagemodernruntime": false,
"parallelcodegen": false,
"pdffunction": false,
"powerfxdecimal": false,
"projectionmapping": true,
"reactformulabar": false,
"reliableconcurrent": true,
"reservedkeywords": false,
"reverttooldpowerautomate": false,
"rtlinstudiopreview": false,
"rtlsupport": false,
"smartemaildatacard": false,
"supportcolumnnamesasidentifiers": false,
"tabledoesntwraprecords": true,
"untypedobject": true,
"usedisplaynamemetadata": true,
"useenforcesavedatalimits": true,
"useexperimentalcdsconnector": true,
"useexperimentalsqlconnector": true,
"useguiddatatypes": true,
"usenonblockingonstartrule": true,
"webbarcodescanner": false,
"zeroalltabindexes": false
},
"Author": "",
"BindingErrorCount": 0,
"ContainsThirdPartyPcfControls": false,
"DefaultConnectedDataSourceMaxGetRowsCount": 500,
"DocumentAppType": "DesktopOrTablet",
"DocumentLayoutHeight": 768,
"DocumentLayoutLockOrientation": false,
"DocumentLayoutMaintainAspectRatio": true,
"DocumentLayoutOrientation": "landscape",
"DocumentLayoutScaleToFit": true,
"DocumentLayoutWidth": 1366,
"DocumentType": "App",
"EnableInstrumentation": false,
"FileID": "310a0be2-b173-4b9a-8674-4698623cb546",
"Id": "21a2c7d4-9b87-410d-9373-7d805b1ef803",
"InstrumentationKey": "",
"ManualOfflineProfileId": "",
"Name": "Analyze Emails",
"OriginatingVersion": "1.333",
"ParserErrorCount": 0,
"ShowStatusBar": false
},
"PublishInfo": {
"AppName": "Analyze Emails",
"BackgroundColor": "rgba(56, 96, 178, 1)",
"IconColor": "RGBA(255,255,255,1)",
"IconName": "Mail",
"LogoFileName": "logo.jpg",
"PublishDataLocally": false,
"PublishResourcesLocally": false,
"PublishTarget": "player",
"UserLocale": "en-US"
},
"ScreenOrder": [
"BrowseScreen1",
"DetailScreen1",
"RespondScreen1"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"25fcc947-df7c-4e8d-80a1-50422e8ffb57": {
"connectionRef": {
"apiTier": "Standard",
"displayName": "Office 365 Outlook",
"iconUri": "https://connectoricons-prod.azureedge.net/u/laborbol/partial-builds/390724148/1.0.1641.3327/office365/icon.png",
"id": "/providers/microsoft.powerapps/apis/shared_office365",
"parameterHints": {},
"parameterHintsV2": {}
},
"datasets": {},
"dataSources": [
"Office365Outlook"
],
"dependencies": {},
"dependents": [],
"id": "25fcc947-df7c-4e8d-80a1-50422e8ffb57"
}
}
Loading
Loading