kwizcom banner advertisement

SharePoint Online: How to Disable Flow in Lists and Libraries?

Requirement: Disable flow in SharePoint Online.

Microsoft Flow is a great tool to automate business processes by building workflows. In some cases, to take control over customization, You may want to disable Flows by hiding the "Flow" button in modern lists and libraries in SharePoint Online.
disable flow sharepoint online

How to Disable Flow in SharePoint Online?
There is no way to disable Microsoft Flow Out-of the box through browser. We've to use PowerShell. Assuming you have the latest SharePoint Online Management Shell installed in your machine, here is how to disable or enable Flow in SharePoint Online site collection via SharePoint Online Management Shell.
#Set parameter values
$AdminSiteURL="https://crescent-admin.sharepoint.com/"
$SiteURL="https://crescent.sharepoint.com/"

#Connect to SharePoint Online Admin Site
Connect-SPOService -Url $AdminSiteURL -Credential (Get-Credential)

# Disable flows on a site collection
Set-SPOSite -Identity $SiteURL -DisableFlows Disabled

#To Enable, use: 
#Set-SPOSite -Identity $SiteURL -DisableFlows NotDisabled
This turns off flow on all the lists and libraries for the given site collection.
turn off flow sharepoint online

Disable Flow on SharePoint Online Site Collection using CSOM:
Instead of SharePoint Online Management Shell, we can also utilize CSOM scripts to turn off flow in SharePoint Online.
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.Runtime.dll"
Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.SharePoint.Client.Tenant.dll"

#Set parameter values
$AdminSiteURL="https://crescent-admin.sharepoint.com/"
$SiteURL="https://crescent.sharepoint.com/"

$Cred= Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
 
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($AdminSiteURL)
$Ctx.Credentials = $Credentials

#Get the tenant object 
$Tenant = New-Object Microsoft.Online.SharePoint.TenantAdministration.Tenant($ctx)

#Get the current Settings for flow
$SiteColl=$Tenant.GetSitePropertiesByUrl($SiteURL, $true)
$ctx.Load($SiteColl)
$ctx.ExecuteQuery()
$SiteColl.DisableFlows

#Disable/Enable Flow
$SiteColl.DisableFlows = [Microsoft.Online.SharePoint.TenantAdministration.FlowsPolicy]::Disabled #To enable, set:  NotDisabled
$SiteColl.Update()
$Ctx.ExecuteQuery()  
This disables Microsoft Flow for all lists and libraries in a given SharePoint Online modern site. All your existing Flows will work as usual but you no longer see that button in the interface. You can still start flow through the waffle however!

Disable Flow on a Site (Sub-Site): 
The above methods disables Microsoft flow for the entire site collection. In some cases, you may wan to disable Microsoft flow on a particular subsite. Here is my PowerShell script to disable Microsoft Flow on a particular site.
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Set parameter values
$SiteURL="https://crescent.sharepoint.com/"

#Get Credentials to connect
$Cred= Get-Credential
$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
  
#Setup the context
$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
$Ctx.Credentials = $Credentials
 
#Disable flow on the Web (Root Web!)
$Web = $Ctx.Web
$Ctx.Load($Web)
$Ctx.ExecuteQuery()

#Disable Flow
$Web.DisableFlows= $true
$Web.Update() 
$Ctx.ExecuteQuery()
You can also remove Flow Licenses from users in Office 365 Admin Panel to restrict them from creating Flows!
SharePoint Online: How to Disable Flow in Lists and Libraries? SharePoint Online: How to Disable Flow in Lists and Libraries? Reviewed by Salaudeen Rajack on October 14, 2017 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.