Skip to content

Commit

Permalink
Merge pull request #8 from Katerina-Chernevskaya/sharepoint-site-assi…
Browse files Browse the repository at this point in the history
…stant

Initial release of the SharePoint Site Assistant sample
  • Loading branch information
Laskewitz authored Jul 19, 2023
2 parents c393f3b + d30aa3a commit 248add3
Show file tree
Hide file tree
Showing 102 changed files with 45,929 additions and 0 deletions.
141 changes: 141 additions & 0 deletions samples/sharepoint-site-assistant/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# SharePoint-Site-Assistant

## Summary

This sample serves to simplify and standardize the site creation process within an organization, offering a tailored experience to users. With a user-friendly interface, the application requires users to respond to seven questions on a Canvas App form, which initiates the creation of a new SharePoint site.

Users have the autonomy to specify the desired site language (English and Lithuanian for now), choose a design from predefined templates, and list external users who they wish to invite as members to the new site. Once these parameters are set and the form is submitted, an automated Power Automate flow is launched, which constructs the site according to the given specifications.

A unique feature of this application is its real-time site name validation system. While filling the form, the entered site name is compared against an existing database to avoid duplication. If a match is found, the system promptly notifies the user, preventing submission until a unique name is provided.

Leveraging cutting-edge technologies such as Graph API, Responsive Design, and Azure Application Insights, this solution offers a harmonious blend of simplicity and advanced functionality.

![SharePoint Site Assistant - Overview](assets/SharePointSiteAssistantOverview.gif)

## Applies to

* [Microsoft Power Apps](https://docs.microsoft.com/powerapps/)
* [Microsoft Power Automate](https://docs.microsoft.com/power-automate/)
* [Microsoft Graph API](https://learn.microsoft.com/en-us/graph/use-the-api)

## 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-red.svg "Premium Power Apps license 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)
--------|---------
sharepoint-site-assistant | [Katerina Chernevskaya](https://github.com/Katerina-Chernevskaya) ([LinkedIn](https://www.linkedin.com/in/katerinachernevskaya/)), Awara IT Academy

## Version history

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

## Features

This sample illustrates the following concepts:

* Responsive design of the Power Apps Canvas app allows convinient work on different devices
* Using the Graph API to instantly validate the inputted site name to prevent duplications.
* Verification of correct form filling before submission, directly within Power Apps.
* Options to select the language for the site.
* Options to select the design for the site.
* Recording user actions for the purpose of analyzing user behavior, with the goal of enhancing the application.
* Display of a list of created sites in the tenant using the Graph API.
* Automation of all site creation actions, including the invitation of external users and sending an invitation email with a link to the created site.

## Prerequisites

* Environment with Dataverse
* Microsoft 365 / Office 365 and Power Apps Standalone license
* App registration (will be used for invitation for external users)

## Solution Components

The following solution components are used in this sample:

* SharePoint Assistant (Canvas App)
* SharePoint Assistant - Site creation (Cloud flow)
* SharePoint site requests (Dataverse table)
* siteAddress (Environment variable)
* siteOwner (Environment variable)
* SharePointAssistantTenant (Environment variable)
* SharePointAssistantClient (Environment variable)
* SharePointAssistantKey (Environment variable)
* textHEX (Environment variable)
* blueHEX (Environment variable)
* lightBlueAccentHEX (Environment variable)
* SharePointSiteAssistant-Dataverse (Connection reference)
* SharePointSiteAssistant-Outlook (Connection reference)
* SharePointSiteAssistant-SharePoint (Connection reference)

## Minimal Path to Awesome

### Create the App Registration

* Open [Azure portal](https://portal.azure.com).
* Go to Azure Active Directory, open `App registration` tab and click on the `New registration` button.
![Step 1](assets/1.png)
* In the registration form enter the `Name` of you new App registration and click the `Register` button.
![Step 2](assets/2.png)
* When the App registration will be created, go to the `API permissions` tab, click the `Add a permission` and select `Microsoft Graph` in the pop-up window.
![Step 3](assets/3.png)
* On the next screen select `Application permissions`, find `User.Invite.All`, select it and click on the `Add permissions` button.
![Step 4](assets/4.png)
* Once you add the permission, click on the `Grant admin consent for <YOUR TENANT NAME>` button.
![Step 5](assets/5.png)
* Go to `Certificates & secrets` tab, click on the `New client secret` button, add `Description` and `Expires` values, and click the `Add` button.
![Step 6](assets/6.png)
* Copy to the Notepad the created secret `Value` before close the browser or navigate to another tab, because this value won't be visible once you leave this page. In addition, go to the `Overview` tab and copy to the Notepad `Application (client) ID` and `Directory (tenant) ID` values. Save these 3 values for later.
![Step 7](assets/7.png)

### Import the solution

* [Download](./solution/SharePointSiteAssistant.zip) the solution `.zip` from the `solution` folder
* Within **[https://make.powerapps.com](https://make.powerapps.com)**, open your target environment, go to the `Solutions` tab, click `Import solution`. In the pop-up window click `Brows` and select the `.zip` file you just downloaded. Click next. Also click `Next` on the next screen.
![Step 8](assets/8.png)
* On the next screen set up connections for `SharePointSiteAssistant-Dataverse`, `SharePointSiteAssistant-Outlook` and `SharePointSiteAssistant-SharePoint`. If the necessary connections aren't available in your environment, locate the drop-down list adjacent to the required connection and select `New connection`. You will then need to establish a new connection in the tab that opens. After you've created the new connection, return to the solution import dialog tab, click on `Refresh`, and your newly established connection should now be visible in the drop-down list.
Once you are ready, click on the `Next` button.
![Step 9](assets/9.png)
* On the next screen provide values for Environment Variables and click on the `Import` button.
* **siteOwner** - the app's admin email that will be used to send email notifications after the process will be completed (in both success or failed cases)
* **SharePointAssistantTenant** - value of the `Directory (tenant) ID` from the App Registration created in the previous step
* **SharePointAssistantClient** - value of the `Application (client) ID` from the App Registration created in the previous step
* **SharePointAssistantKey** - value of the `Secret value` from the App Registration created in the previous step
* **textHEX** - the color for text (in HEX format)
* **blueHEX** - the color for controls like button or selected icons (in HEX format)
* **lightBlueAccentHEX** - the color for accent (in HEX format)
![Step 10](assets/10.png)

* After the solution is imported, open it and share the Canvas App with all users who require access. Remember to allocate the suitable security role to these users, as well as to assign the necessary licenses.
![Step 11](assets/11.png)

Once all the steps have been completed, the users with whom the app was shared will gain the capability to use this app for submitting requests to create SharePoint Sites.

## 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=sharepoint-site-assistant&authors=@Katerina-Chernevskaya&title=sharepoint-site-assistant%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=sharepoint-site-assistant&authors=@Katerina-Chernevskaya&title=sharepoint-site-assistant%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=sharepoint-site-assistant&authors=@Katerina-Chernevskaya&title=sharepoint-site-assistant%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/sharepoint-site-assistant" />
Binary file added samples/sharepoint-site-assistant/assets/1.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 samples/sharepoint-site-assistant/assets/10.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 samples/sharepoint-site-assistant/assets/11.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 samples/sharepoint-site-assistant/assets/2.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 samples/sharepoint-site-assistant/assets/3.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 samples/sharepoint-site-assistant/assets/4.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 samples/sharepoint-site-assistant/assets/5.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 samples/sharepoint-site-assistant/assets/6.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 samples/sharepoint-site-assistant/assets/7.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 samples/sharepoint-site-assistant/assets/8.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 samples/sharepoint-site-assistant/assets/9.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.
Binary file not shown.
8 changes: 8 additions & 0 deletions samples/sharepoint-site-assistant/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>17f69f00-dc93-4b6e-9ea5-920212b4d01e</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>kch_sharepointassistant_35d1a</Name>
<AppVersion>2023-07-19T07:58:39Z</AppVersion>
<Status>Ready</Status>
<CreatedByClientVersion>3.23071.11.0</CreatedByClientVersion>
<MinClientVersion>3.23071.11.0</MinClientVersion>
<Tags>{"primaryDeviceWidth":"1366","primaryDeviceHeight":"768","supportsPortrait":"true","supportsLandscape":"true","primaryFormFactor":"Tablet","publisherVersion":"3.23071.11","minimumRequiredApiVersion":"2.2.0","hasComponent":"false","hasUnlockedComponent":"false","isUnifiedRootApp":"false","sienaVersion":"20230705T074201Z-3.23062.17.0"}</Tags>
<IsCdsUpgraded>0</IsCdsUpgraded>
<GalleryItemId xsi:nil="true"></GalleryItemId>
<BackgroundColor>rgba(255, 255, 255, 1)</BackgroundColor>
<DisplayName>SharePoint Assistant</DisplayName>
<Description>This is the final tested version of the app with App Insights</Description>
<CommitMessage xsi:nil="true"></CommitMessage>
<Publisher></Publisher>
<AuthorizationReferences>[]</AuthorizationReferences>
<ConnectionReferences>{"0c59d51b-6914-4f76-90ed-333153cbb065":{"id":"/providers/microsoft.powerapps/apis/shared_office365groups","displayName":"Office 365 Groups","iconUri":"https://connectoricons-prod.azureedge.net/u/laborbol/partial-builds/390724148/1.0.1641.3327/office365groups/icon.png","dataSources":["Office365Groups"],"dependencies":[],"dependents":[],"parameterHints":{},"parameterHintsV2":{},"isOnPremiseConnection":false,"bypassConsent":false,"dataSets":{},"apiTier":"Standard","actions":["HttpRequest"]},"91ab881a-49c0-4031-bbc3-95b3b8a746f9":{"id":"/providers/microsoft.powerapps/apis/shared_logicflows","displayName":"Logic flows","iconUri":"https://connectoricons-prod.azureedge.net/releases/v1.0.1645/1.0.1645.3345/logicflows/icon.png","dataSources":["SharePointAssistant-Sitecreation"],"dependencies":["e4f51bee-d0ed-43cc-baee-f6062e991018","b2172242-646f-4544-a5d2-60edda0dbd05","5b6050e2-00ad-4f68-9907-86b3a4f38ade","e4f51bee-d0ed-43cc-baee-f6062e991018"],"dependents":[],"parameterHints":{"workflowName":{"value":"a0d89d52-0eee-457b-9427-1b7a100294c6"},"workflowEntityId":{"value":"2ce870d2-ab19-ee11-8f6d-6045bdf5263a"},"e4f51bee-d0ed-43cc-baee-f6062e991018":{"value":"shared_sharepointonline"},"b2172242-646f-4544-a5d2-60edda0dbd05":{"value":"shared_office365_1"},"5b6050e2-00ad-4f68-9907-86b3a4f38ade":{"value":"shared_commondataserviceforapps_1"}},"parameterHintsV2":{"workflowName":{"value":"a0d89d52-0eee-457b-9427-1b7a100294c6"},"workflowEntityId":{"value":"2ce870d2-ab19-ee11-8f6d-6045bdf5263a"},"shared_sharepointonline_1":{"value":"e4f51bee-d0ed-43cc-baee-f6062e991018"},"shared_office365_1":{"value":"b2172242-646f-4544-a5d2-60edda0dbd05"},"shared_commondataserviceforapps_1":{"value":"5b6050e2-00ad-4f68-9907-86b3a4f38ade"},"shared_sharepointonline":{"value":"e4f51bee-d0ed-43cc-baee-f6062e991018"}},"isOnPremiseConnection":false,"bypassConsent":false,"dataSets":{},"apiTier":"Standard","actions":["Run"]},"e4f51bee-d0ed-43cc-baee-f6062e991018":{"id":"/providers/microsoft.powerapps/apis/shared_sharepointonline","displayName":"SharePoint","iconUri":"https://connectoricons-prod.azureedge.net/u/shgogna/globalperconnector-train1/1.0.1639.3312/sharepointonline/icon.png","dataSources":[],"dependencies":[],"dependents":["91ab881a-49c0-4031-bbc3-95b3b8a746f9"],"parameterHints":{},"parameterHintsV2":{},"isOnPremiseConnection":false,"bypassConsent":false,"dataSets":{},"apiTier":"Standard"},"b2172242-646f-4544-a5d2-60edda0dbd05":{"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":[],"dependencies":[],"dependents":["91ab881a-49c0-4031-bbc3-95b3b8a746f9"],"parameterHints":{},"parameterHintsV2":{},"isOnPremiseConnection":false,"bypassConsent":false,"dataSets":{},"apiTier":"Standard"},"5b6050e2-00ad-4f68-9907-86b3a4f38ade":{"id":"/providers/microsoft.powerapps/apis/shared_commondataserviceforapps","displayName":"Microsoft Dataverse","iconUri":"https://connectoricons-prod.azureedge.net/releases/v1.0.1641/1.0.1641.3326/commondataserviceforapps/icon.png","dataSources":[],"dependencies":[],"dependents":["91ab881a-49c0-4031-bbc3-95b3b8a746f9"],"parameterHints":{},"parameterHintsV2":{},"isOnPremiseConnection":false,"bypassConsent":false,"dataSets":{},"apiTier":"Premium"}}</ConnectionReferences>
<DatabaseReferences>{"default.cds":{"databaseDetails":{"referenceType":"Environmental","environmentName":"default.cds","overrideValues":{"status":"NotSpecified"}},"dataSources":{"Environment Variable Definitions":{"entitySetName":"environmentvariabledefinitions","logicalName":"environmentvariabledefinition"},"Environment Variable Values":{"entitySetName":"environmentvariablevalues","logicalName":"environmentvariablevalue"},"SharePoint site requests":{"entitySetName":"kch_sharepointsiterequestses","logicalName":"kch_sharepointsiterequests"}}}}</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":[{"dependencyid":"2ce870d2-ab19-ee11-8f6d-6045bdf5263a","componenttype":29,"componenttypeplatformname":"Workflow"},{"logicalname":"environmentvariabledefinition","componenttype":1},{"logicalname":"environmentvariablevalue","componenttype":1},{"logicalname":"kch_sharepointsiterequests","componenttype":1}]}</CdsDependencies>
<IsCustomizable>1</IsCustomizable>
<BackgroundImageUri>/CanvasApps/kch_sharepointassistant_35d1a_BackgroundImageUri</BackgroundImageUri>
<DocumentUri>/CanvasApps/kch_sharepointassistant_35d1a_DocumentUri.msapp</DocumentUri>
</CanvasApp>
Binary file not shown.
Binary file not shown.
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.
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.
Loading

0 comments on commit 248add3

Please sign in to comment.