Showing posts with label SPFX Extension. Show all posts
Showing posts with label SPFX Extension. Show all posts

Speaking at Global Microsoft 365 Developer BootCamp at Bangalore

Glad to announce, I am going to speak in Global Microsoft 365 Developer BootCamp at Bangalore

Session:- "Hands On Lab " Building business solutions using SPFx and PowerApps



Join and Learn How to leverage powerapps solution with shar point framework extension.

Session:-  Simplify user authentication using Microsoft Identity Platform


Join and Learn How to build an application using  Microsoft identity with one sign in experience.


Event Agenda:-
https://www.eventbrite.com/e/global-microsoft-365-developer-bootcamp-2019-tickets-65257785794

Leverage Power Apps with SharePoint Framework Extension

PowerApps is an enterprise service that lets you connect, create, and share business apps with your team in minutes and help to build highly tailored application with optimize user experience. You can expedite the business solution with Power Apps as well as SharePoint Online.

Problem Statement

We are creating a solution for audit department. Audit department need to maintain the reports as well as reference document during audit process.

Blueprint approach


Let’s gets start, how we can design and implement such problem statement in optimize way.


Solution Approach

  1. Create Library to store content and List or Library to store all reference documents.
  2. Design SPFx extension solution to deploy at specific library, which will call Modal Dialog with Iframe.
  3. Design Power Apps form calls the same from Modal Dialog with Iframe section.
  4. PowerApps form then saves the data into SharePoint Online List or Library.

Prerequisites


1.      Office 365 subscription

2.      SPFX environment set up
3.     Install visual studio code for code editor - https://code.visualstudio.com/ 
4.     Office 365 Subscription should have access to PowerApps.

Implementation approach

Step1: Create Schema 

  • Login to SharePoint Online Teams or Communication site
  • Create Library with name: Audit Report
  • Create a List with name: Audit Reference
First, Let’s start with power apps form creation

Step 2: Navigate to PowerApps Form

Step 3: Create Canvas App 


Click on ‘Canvas app from blank’.





Step 4: Power App Name

  • Select app name as ‘Audit Report Reference’, click ‘Create’.

Step 5: Update the app size.

Go to file from menu bar, then select settings -> click on ‘screen size + orientation’ -> select custom give width as 1024 and height as 550.


Click Apply and back button.

Step 6: Rename the Screen

Rename default Screen1 as ‘EditScreen’. Clicking on 3 dots will give option to rename.


Step7 Insert Form and Rename to Edit Form
Click on ‘insert’ from menu bar. Select ‘Edit’ form.

Rename form1 as ‘EditFrom’

Step 8: Connect to SharePoint Online Data source

 Click on ‘connect to data’.


Search for SharePoint in data source options. And select SharePoint.

Type/paste your site URL, and click ‘connect’.

Select the list ‘Audit Reference’. Click ‘Connect’.

Step 9: Change Form DataSource and Form Mode

Select ‘EditForm’, and select data source as ‘Auditreference’ and default mode as ‘New’ from right pane properties.



Step 10: Populate Fields at Form

Edit form populate with fields.
Select datacardvalue of ‘Title’ field.


Step 11: Modify the default formula of Control

Change the default formula as ‘Param("Input")’

Step 12: Add Button Control and Set Navigation

Select ‘EditScreen’. Click on ‘insert ’ on menu bar. Click on button.


Button will get added to screen, rename the button as ‘Save’, in left side tree view.
Place (Drag and drop) the button below the screen,
Select the button and Change the button text as ‘Save’

Step 13: Add new screen for display message

  • Select ‘Insert’ in menu bar. Add new blank screen.
  • Rename that screen as ‘DisplayScreen’ in left side tree view.
  • Select displayScreen and add a label from menu bar insert option.
  • Rename the label as ‘DisplayMessage’.
  • Select label text option and give text as ‘Reference saved successfully, Please click close button to exit the window’
  • Select label. From menu bar select home, change the font size to 24. Alignment as center aligned.
  • Change the text color to blue.
  • Update the label position, size and padding in label properties as shown in below screenshot.

Step 14: Update Navigation

Select EditScreen. Then select ‘Save' button and update ‘OnSelect’ Property to ‘SubmitForm(EditForm);Navigate(DisplayScreen,ScreenTransition.Fade)


Step 15: Save and publish the PowerApps form

Go to ‘File’ from menu bar. Click on Save & Publish

Store the app id , we need to use the same in SPfx Extension.


Let’s Start with SharePoint Extension i.e. List View Command Set

Step 16: Create and SPFX Extention Solution


Navigate to folder structure and type Code  .
Command "yo @microsoft/sharepoint"

Create SPFx Extension Solution with below selected options


Set Command Name and Description

After couple of seconds, you will get below congratulation message. SharePoint Framework extension solution created successfully.

Step 17: Set Extension to specific Library

You can add extension to specific library as per below command  and use RowAccessor to get Row or Item values.


Add Reference “RowAccessor

Step 18: Add Modal Dialog Reference TSX file




Step 19: Add Index file to call out Modal Dialog Window


Step 20: Remove unused command set



Step 21: Modify the Template and Registration ID to Document Library



Step 22: Build, Bundle and Package the Solution

  • npm install "react-iframe" --save
  • gulp build
  • gulp bundle --ship
  • gulp package-solution –ship


Step 23: Deploy package to app catalog

Login to SharePoint site and redirect to ‘Site Contents’.
Click on ‘Apps for SharePoint’.
Click on ‘Upload’ button


Select .sppkg package from your solution and click on ‘Ok’
Click on ‘Deploy’ in dialog window.
Verify for successful deployment.  Also verify for deployment errors.

Step 25: Add an app to SharePoint site

Redirect to ‘Site Contents’.
Click on ‘New’ then ‘App’.
Add the solution ‘m-365-Bangalore-client-side-solution’.
Verify app is available in SharePoint ‘site contents’


SPFx solution can be dowload from GitHub also  https://github.com/manoj1201/SPFXExtwithPowerapps 

The Output


Finally, How output  look like

1. Select Item at Library and select List View extension


How easy and quick it was to build a custom PowerApps solution with SharePoint Framework Extension.
Hope you have enjoyed and learned something new in this article. Thanks for reading and stay tuned for the next article.

How to Add List View command Set To both List And Document Library using SPFX Extension

SharePoint Framework extensions extend the user experience toward the SharePoint Online Modern Framework List and Library to render custom components.
There are three types of SharePoint framework extensions:
  1. Application level customizer – basically used to render custom component to defined placeholder example Top Navigation, Footer, etc.
  2. Fields level customizer – basically used to render the field level modification within views.
  3. List View Command Set – basically used to render a new action at the list view level. 
In this article, we are going to discuss how to enable List view command set to Generic List and Document library level.
Let’s get started.
Step 1 - Generate SharePoint Framework Extension
Open the command prompt and create a blank folder




  1. md Extension  
Step 2

Navigate to the created directory.


Step 3
Run the  yeoman command,
  1. yo@microsoft/sharepoint   


  • Enter the name of Solution: Metadata
  • Select “SharePoint Online” baseline package you want to target for your component(s).
  • Select “Use the current folder” place the files.
  • Select “Extensions” to the type of client-side component.
  • Select “ListView Command Set” as a type of client-side extension
  • Enter command Set name: Metadata

Yeomen will take a couple of minutes to install required dependencies and scaffolding the SPFX project. Finally, you will get the below “congratulations “ message.



Step 4
Navigate to Visual Studio Code to open the solution.
  1. Type Code .  
It will open the project into an open source IDE, i.e., Visual Studio Code (condition - Visual Studio Code needs to be installed). Navigate to SharePoint Folder Structure -> assets -> element.xml.
Custom Action tag has Registration Id of 100 which means it's associated with Generic List. We need to change the Registration Id from 100 to 101 which means it will associate the SPFX extension component to Generic Library.





NoteIf you want to use the same custom SPFX extension to both list and library, copy and paste the same custom action and section one RegistrationId assign to 101. 




Step 5
Open Integrated Terminal to build sppkg package using gulp command,



Step 6 - Run Gulp Build

It will build a solution and create two new folders - Lib and Temp



Step 7 - Run Gulp Bundle –ship

It will bundle all JS and CSS files and make it ready to bundle files in CDN. It creates a dist folder.


Step 8 Package Deployment at Site Collection Level
The package can be deployed at Tenant Level App Catalog or Site collection level App Catalog. It really depends on the project scenario and governance policies to the usage of the designed app which is the preferred option. Let's proceed with site collection level app catalog.
Navigate to Modern site collection.
Go to Site Content -> App for SharePoint -> Upload the .SPPKG file.



Click to deploy the solution.

Step 9 

Navigate to Site Content.
Click New -> Add APP.

Step 10
Add Apps to Site Collection Level.


NoteWait for a couple of seconds to activate the solution.
Step 11
Browse any generic template created  list and select item, you will find Command One and Command Two at the top of list view. Click on the command One text, it will prompt a custom message given in SPFX Extension solution.

Step 12
Browse any generic template created Library and select item, you will find Command One and Command Two at the top of list view. Click on the command One text, it will prompt a custom message given in SPFX Extension solution.


Hope you have learned something new in this article. Stay tuned for more related articles to get more insights and learning.