Send the Documents on Schedule basis using HTTP Request To SharePoint In Power Automate

In this Blog post I am going to explain how to move the SharePoint list attachments based on the scheduler and the item sechduled date reached to current date.

Lets start with step by step procedure,

Login to Flows.microsoft.com and select the template as Recurrence and do the configuration as per the requirement, here I have configured the scheduler which runs at every day morning 8:30 AM IST.

Then get the current date by assigning to variable, the format will be formatDateTime(utcNow(),’yyyy-MM-dd’)

The next step would be filter the items based on the current date,

Once you get the items then we need fetch item attachments one by one,

Once we get the attachments then we need to upload the attachments on the Document library,

the above steps will move the attachments on the selected destination library, still if we need to update the document metadata properties please do the below additional step,

Select Send an HTTP request to SharePoint then do the below configuration,

This will update all the source item metadata properties on the document properties.

The same way we can do the configuration for SharePoint list items as well, here is the supported Blog with detailed steps.

Posted in Uncategorized | Leave a comment

Upload SharePoint list item attachments in the Document library using MS Flow

In this post, I am going to explain how to upload SharePoint list item attachments in the Document library using MS Flow

The initial requirement whenever a new item is created I need to pick the attachments and move to dynamic library, let me explain the step by step procedure.

Login https://flow.microsoft.com and select the SharePoint template when an item is created,

Here the I am picking the document library name value as dynamically form the current item property,

Once the approver approves the request the current item attachments will move to the selected Document library.

Here the Folder path will be dynamic.

Once the all the steps are executed successfully the attachments will be moved to selected document library.

Posted in Uncategorized | Leave a comment

How to integrate SQL to third party API in Azure using API Management services and Logic Apps

Recently I got a requirement from the business that we need to integrate the data from SQL to Thrid party API, the data should be sync on daily basic so I have used API Management service and Logic Apps.

Let me explain step by step about the integration procedure,

Step 1 : Create a API Management services,

Open https://portal.azure.com/ and search API management –> create it

select the Region, provide the required field values and finally select the Pricing tier and other settings keep as is then create it, might it will take a couple of minutes to complete the creation process, please wait till the process complete.

Once it’s created successfully please open the newly create one and Add new API by selecting the available template, here I have API which in WSDL format so I have chosen WSDL API template.

Once you select the WSDL will open a form, provide all required information and create it.

once the creation completed by default it will populate all the inbuilt methods from the API, please select the required method and do the configuration as per the requested API, please use the below steps to add the Headers and Request values,

Once all the configuration completed please navigate to Test tab by selecting the required method and copy the below values.

Note: By default the subscription key will not display, please click on the eye icon then copy the value.

Step 2: Create a Logic App to update the data based on the schedule

Open https://portal.azure.com/ and search Logic Apps –> create it

Here I would prefer to use the same Resource Group and Location for both API Management service and Logic App because once you done the development it’s easy to move to Production subscription.

Open the newly created Logic App and select the Designer part and add the Recurrence step, and do the configuration as per the requirement here my requirement is needed to run every day at 5 am.

Now add one Variable to get the current date -1 dynamically to filter the data form SQL stored procedure, the expression will be : addDays(utcNow(),-1,’dd-MM-yyyy’)

Now add the Execute Stored Procedure and do the below configuration, here select the property getdate ( from SQL procedure ) and provide the variable value.

Now we have the complete response, the next step add the ForEach and do the below configuration, here I am parsing the date value form the result to do that please use the below format,

replace(items(‘For_each’)?[‘SubmittedDate‘],’-‘,”) ( SubmittedDate will be table SQL table column which stores the submitted value )

Then select the HTTP to send the request,

Note: The URI, Headers values will be API Management service value which we have created on Step 1.

Body is kind of response which will provide by the customer, here we need to provide the dynamic parameters to update the values.

I just want to add a couple of additional steps here, for example if we want to do integration with other API also please append the below steps.

Inside the For each add condition to compare if the value is null execute the alternative step,

In this case, if we want to execute 2 steps, the above steps will execute as is on else case need to get the other value please add HTTP request and capture the response to Variable

Once you get the response as Body to split the result use the below expression,

split(variables(‘VariableName‘),’Output Expected string’)?[1]

Add one more step Set Variable use the same variable and use the below Expression

substring(variables(‘VariableName‘),0,9)

Here the VariableName is which you get the response as BODY.

Finally the last Variable will have the final string output.

Hope this will helpful to implement any integration 🙂

Posted in Uncategorized | Leave a comment

How to remove Banner/Title From the SharePoint modern Communication pages

By default when you create SharePoint modern page Banner/Title area will be added to the page.

Unfortunately so far there is no option to hide/display the area manually, let me explain bit clear on this when you create a any modern site the site home page layout will be set as Home and for newly creating pages it will be Article.

We don’t have option to change the page layout, the only feasible solution we can control through PowerShell script.

#Connect to the site
Connect-PnPOnline https://XXXXXX.sharepoint.com/sites/XXXXX
#List all pages, and find the id of the modern page
Get-PnPListItem -List SitePages
#Change layout from “Article” to “Home” to remove top banner here 2 is the Page ID
Set-PnPListItem -List SitePages –Identity 2 -Values @{“PageLayoutType”=”Home”}
#To revert back the page layout to Article
Set-PnPListItem -List SitePages –Identity 2 -Values @{“PageLayoutType”=”Article”}

After the commands executed successfully the Banner/Title will be hide from the page.

How to copy the Pages from the SharePoint modern sites

From the SharePoint modern site pages library you can’t download the pages even if you have the SCA access, to perform this there is workaround please generate a URL to download the specific file.

SiteCollectionURL/_layouts/15/download.aspx?SourceUrl=SiteCollectionURL/SitePages/default.aspx [ Default : page name ]

EX:

https://XXXXX.sharepoint.com/sites/XXXX/_layouts/15/download.aspx?SourceUrl=https://XXXX.sharepoint.com/sites/XXXX/SitePages/default.aspx

If you run this command on browser the page will download.

Hope this blog will helpful 🙂 🙂

Posted in Uncategorized | Leave a comment

How to get an SCA access site collections on Office 365 for specific users using PowerShell

Whenever we need to perform the cleanup activity on Office 365 tenant are might sometimes we required to get the SCA access on all SharePoint sites for specific users. To achieve functionality I have built a PowerShell script which will provide the consolidated report with all site collections.

Let me explain the execution steps, before using this script please make sure to create a Client ID and Secret values with tenant-level full control access.

<AppPermissionRequests AllowAppOnlyPolicy=“true”> <AppPermissionRequest Scope=http://sharepoint/content/tenant&#8221; Right=“FullControl” /> </AppPermissionRequests>

Here we are going to execute the script using a Client ID and Secret values because though if you are the Global Admin also you might don’t have access to most of the site collections.

Here is the execution script to get the list of information,
$TenantUrl = ‘Tenat URL’

$LogPath = ‘C:\AllUsers.txt’   #Replace your path to store the site collection report

Connect-PnPOnline -Url $TenantUrl -ClientId “XXXXXXXXXX” -ClientSecret “XXXXXXXXXX”

# Get the site collections
$GetSiteColl=Get-PnPTenantSite

Write-Host “Total Site collections Count” $GetSiteColl.Count -ForegroundColor Green

$SiteNumber=0
# Loop through the site collections
foreach($Site in $GetSiteColl)
{
$SiteNumber++

Write-Host “Processing Site no:” $SiteNumber $Site.Url -ForegroundColor Green
Connect-PnPOnline -Url $Site.Url -ClientId “XXXXXXXXXX” -ClientSecret “XXXXXXXXXX”
$SCAUsers=Get-PnPSiteCollectionAdmin
foreach($SCAUser in $SCAUsers)
{

#Replace your email vlaues
if(($SCAUser.Email -eq ‘XXXXXXX@microsoft.com’) -or ($SCAUser.Email -eq ‘XXXXXXX@microsoft.com’) -or ($SCAUser.Email -eq ‘XXXXXXX@microsoft.com’) -or ($SCAUser.Email -eq ‘XXXXXXX@microsoft.com’)){
# if($sca.Email -eq ‘XXXXXXX@microsoft.com’){
# Write-Host “Site collection URL” $sca.Email -ForegroundColor Green
‘User : ‘ + $SCAUser.Email + ” Having SCA access on the site ” + $Site.Url | Out-File $LogPath -Append
}
}
}

Posted in Uncategorized | Leave a comment

Office 365 custom site collection redirection using SPFx application customizer

Hello Everyone,

Recently I got one requirement that has to redirect the user from old modern site collection to new modern site collection and the old site should accessible for Full control and SCA user permissions.

Generally, in Office 365 classic sites, we can develop this redirection functionality on the master page, that will handle the redirection part but when comes to modern sites there is no master page or manual script injection functionality is deprecated.

To achieve this Microsoft provided the new feature called SPFx Application Customizer, through this approach we can deploy our custom redirection functionality which will execute on all the pages quite similar master page placeholders.

Here  I am dynamically controlling the redirection values form custom SharePoint list created on a centralized site collection, before implementing the functionality create one SharePoint list by following the columns,

Title :  /sites/XXXXX  [ Old site collection relative URL ]

Redirection URL:  New site collections value

Note: Create this list on a separate site collection, for each and every site collection place one entry on this list.

Let me walk through the code,

Create an SPFx Application Customizer, and place the below code on .ts file

 @override

  public onInit(): Promise<void> {
    Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);
    const isSiteAdmin : boolean = this.context.pageContext.legacyPageContext.isSiteAdmin;
    const permissionValue : number = this.context.pageContext.web.permissions.value.High;  //2147483647
    const siteRelativeUrl: string = this.context.pageContext.legacyPageContext.siteServerRelativeUrl;
    let redirectionURL: string;
    let rooSiteURL: string = ‘https://XXXXXX.sharepoint.com/‘;  //Site collection to store the redirection values from the custom list
    if(permissionValue != 2147483647){
      if(!isSiteAdmin){
        this.getRedirectionURL(rooSiteURL,siteRelativeUrl).then(redirectionURLItem => {
          if ( redirectionURLItem.length > 0 ) {
            for (var i = 0; i < redirectionURLItem.length; i++) {
                redirectionURL= redirectionURLItem[i].Redirection_x0020_URL;
                console.log(`Redirection URL: ${redirectionURL}`);
            }
            location.href = redirectionURL;
          } else {
            Dialog.alert(`It appears that there is no site entry on the root site list… \n\n Please configure and try again…`);
          }
        });
      }
    }
    return Promise.resolve();
  }
   public getRedirectionURL(rooSiteURL,siteRelativeUrl) : Promise<any[]> {
      let pnpweb = new Web(rooSiteURL);
        return new Promise<any[]>((resolve, reject) => {
          pnpweb.lists.getByTitle(“listname“).items.select(“Title,Redirection_x0020_URL”).filter(“Title eq ‘”+ siteRelativeUrl +”‘”).getAll().then((allItems :any[])=> {
            resolve(allItems);
          });
       });
  }
}

 

Cheers 🙂

 

Posted in Uncategorized | Leave a comment

How to scan Office 365 sites data using a modernization scanner.

In this blog post, I will explain how to scan Office 365 site data using a modernization scanner.

Using the SharePoint Modernization scanner you can prepare your classic sites for modernization. The scanner will help you prepare for the following modernization efforts:

  • Optimizing the usage of modern list and libraries
  • Connecting these sites to a Microsoft 365 group
  • Modernizing the wiki and web part pages by creating modern site pages
  • Rebuilding classic publishing portals as modern publishing portals
  • Understanding where classic workflow is used
  • Understanding where InfoPath is being used
  • Understanding the usage of classic blog pages

To get the information please follow the below steps,

Step1: Download the modernization scanner tool using the link.

Step 2: After successful download open it by Run As administrator.

Capture

Step 3: It will prompt a tool with different authentication options, select the suitable option if you want use Client id and Secret provide tenant-level full access, or if you want to use any service account make sure the account should have full control in all site collections.

Step 4: Select the site collections options, we have multiple options available  Tenant/selected sites/from CSV file and provide the tenant name (the only name don’t include -admin )click Next.

Capture1

Step 5: Select the scan mode form the dropdown based on the requirement and click Next.

Capture2

Step6:  Then finally update the Number of parallel threads to use 20 by default it will be 10 and click Start Scan.

Capture3

Finally, once the scan completed a new folder will be created from where you are executing the tool and will place all the reports inside the folder.

 

Posted in Uncategorized | Leave a comment

Create custom registration form using Power Apps

There are two options are available to create a registration forms using Power Apps.

  1. From SharePoint list there is one option called Customize forms, by using this option we can create and replace the default list new form.
  2. From the portal there are two options available  Canvas and Model-driven, in this blog post I am going to explain how to create canvas forms, which will save the data to SharePoint list using custom validations.

Let’s start with steps how to create the canvas form,

Open the site http://make.powerapps.com/ –> select the template Canvas app from blank –> Select the device Tablet/Phone and provide the name of the form and finally click Skip Option,

Capture1

After that click on the Connect to data,

Capture2

After connecting to the data search SharePoint and connect to your Site and list,

Capture3

Capture4

After establishing a connection you can design the form as per the business requirement, the below screen I have added only few controls to save the data in SharePoint list,

Capture5

  1. On the top I have added two labels On Select event I am navigating to Screen 3 Navigate(Screen3).
  2. Employee Name field by default it will populate current user email:  User().Email
  3. Location is the Dropdown value which the values are binding from the sharepoint list column.
  4. Registration Date : the fields is populating by default the current date : Today()
  5. Other Members: In Power Apps there is no direct functiantliy to get the users like people picker control to achieve we have to do some work around,
    Add Text box control on top of List box, and set the below properties to it:
    1. Default – SelectedUserEmail
    2. OnSelect – Set(ShowUsersListBox,true)
    Add List box controls and set the below properties to it:
    1. Items – If(!IsBlank(TxtMember.Text), Office365Users.SearchUser({searchTerm:TxtMember.Text}).Mail)
    2. Visible – ShowUsersListBox
    3. OnSelect – Set(SelectedUserEmail, ListBox.SelectedText.Value); Set(ShowUsersListBox,false);Reset(TxtMember)

    ( Before this establish connection to Office 365 users by using the Datasource option )

  6. Save button:  OnSelect :  If( !IsBlank( TxtMember.Text ),Patch(‘ListName‘,Defaults(‘ListName‘),{Title:TxtEmpname.Text,Location:DdlLocation.SelectedText,Requested_x0020_Date:DtDate.SelectedDate});Navigate(Screen2);Reset(TxtEmpname);Reset(DdlLocation);Reset(DtDate);Reset(TxtMember))
  7. Display all Items (label) :  OnSelect event : Navigate(Screen3)
  8. NewScreen3: This screen added by selecting the List design and the Datasource ( you can find this option from the right side properties ) is required sharepoint list.
  9. On the new screen the items will be displaying in the list view,  Navigate(Screen5,ScreenTransition.Fade,{selectedID:TemplateGalleryList2.Selected.ID})Capture7
  10. Again go back to Screen5 click on the Insert –> Forms –> select Display optionCapture8
  11. Now click on the connect data –> from the left panel you have to select the Data Source as the table name –> then click on the Edit fields inside the Data source dropdown –> from the new panel click on Add field –> now choose which fields should be displayed on the newly created form –> finally click on the Add button. On the new screen 5 Item event   First(Filter(‘Quick Race Registrations’,ID=selectedID))  to filter the result.Capture9

After all configuration completed publish the Power app.

Posted in Uncategorized | Leave a comment

Get Users from the SharePoint group using Microsoft Flow

While working with Microsoft Flow there is no direct option to retrieve the users from the SharePoint group, if you have any requirement to send a notification emails to the all users under the SharePoint group there is one separate action called ‘Send an HTTP request to SharePoint’  using this action you can call the SharePoint REST API and perform all sorts of operations.

By using the API, you can get all users in a specific SharePoint Group with the following REST call,

https://<siteurl>/_api/web/sitegroups/getbyname(‘<groupname>&#8217;)/users

Let me explain step by step procedure to retrieve users, here I am sending the notification to group users when a new item is added to the specific list.

Steps:

Login the Url https://flow.microsoft.com/ and create a template and select When an item is created and provide the Flow name,

Capture10

Configure the site and list value when an item added the flow will trigger,

Capture11

Add the ‘Send an HTTP request to SharePoint‘ action and configure it so that you call the API as stated above.

Capture

After selecting the template to configure a group name to retrieve the users,

Capture1

Site Address: Site Collection URL

Uri : /_api/web/sitegroups/getbyname(‘groupname‘)/users

Initialize variable ‘SPGroupUsers‘ as an array type and the value should look like this,

body(‘Send_an_HTTP_request_to_SharePoint’)[‘d’][‘results’] use this syntax under the Expression tab and click OK.

Capture2

Intialize two variable one to store the all users email values and second to increment the integer value,

Capture3

Capture4

Add Apply to each and add ‘SPGroupUsers‘ in output which we created for array, and add Append to string action,

Capture5

Add concat(variables(‘SPGroupUsers’)[variables(‘i’)][‘Email’],’;’)

Capture6

Then add output filed to existed array value,

Capture7

After adding the variable select increment variable and under the Append to string variable,

Capture8

Finally Initialize new variable and set the value to it.

Capture9 

Finally AllUsers variable is having the all SharePoint group users, so if you want to send an email simply use the variable wich will sent to all users.

Posted in Uncategorized | Leave a comment

Display SharePoint items as Banners using SPFx

In this blog post, I am going to explain how to perform the SharePoint items as banners.

Here I have provided two solutions, the first one is manual configuration based on the web part property values single banner will be rendered on the page if you want to display multiple banners on the page need to configure multiple web parts with the required values, here is the example of how to configure the properties from SPFx web part,

BannerConfiguration

Once the configuration completed a single banner will be placed on the page which looks like,

BannerImage

Let’s come to a second approach here I used to display the items from the SharePoint list,

DynamicBanners

From the list, I have created several columns to configure the banner properties, after adding the items on the SharePoint list, edit the page and add the web part and do the below configuration from the property values.

DynamicBannersConfiguration

From the above screen, the first property Select List will populate all the available lists except hidden within the current site collection.

After selecting the list there are some additional configuration properties provided to control the banners on the page after the configuration is completed all the selected list items will be renders as a Banners as per the below screen.

DynamicBannerItems

If you observe on the above slide there is space between banners, Font size, and the other things are displaying based on the web part property configuration values.

I have uploaded the complete code files on the link.

 

Posted in Uncategorized | Leave a comment