<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-903616810236979972</id><updated>2020-08-06T16:47:11.583+05:30</updated><category term="SharePoint"/><category term="PowerShell"/><category term="SharePoint Online"/><category term="SharePoint 2013"/><category term="SharePoint 2010"/><category term="SharePoint 2016"/><category term="Client Side Object Model (CSOM)"/><category term="PnP PowerShell"/><category term="SharePoint 2007"/><category term="Known Issues"/><category term="List"/><category term="CSV"/><category term="Permission"/><category term="Admin Reports"/><category term="Document Library"/><category term="Tips and Tricks"/><category term="Security"/><category term="Troubleshooting"/><category term="Search"/><category term="Office 365"/><category term="Site Collection"/><category term="Administration"/><category term="Errors"/><category term="Column"/><category term="Migration/Upgrade"/><category term="Users and Groups"/><category term="C#"/><category term="Content Type"/><category term="SharePoint Online Management Shell"/><category term="User Profile"/><category term="Folder"/><category term="Branding"/><category term="Configuration"/><category term="SharePoint Designer"/><category term="Active Directory"/><category term="Subsite"/><category term="Central Administration"/><category term="Managed Metadata"/><category term="File"/><category term="Deployment Guides"/><category term="IIS"/><category term="Service Application"/><category term="jQuery"/><category term="Best Practices"/><category term="Navigation"/><category term="OneDrive for Business"/><category term="SQL Server"/><category term="SharePoint Development"/><category term="List View"/><category term="Object Model"/><category term="Reference"/><category term="List Forms"/><category term="Utilities"/><category term="Alerts"/><category term="CSS"/><category term="Customizations"/><category term="Features"/><category term="Recycle Bin"/><category term="web.config"/><category term="SharePoint Database"/><category term="List Settings"/><category term="People Picker"/><category term="Site Columns"/><category term="Version History"/><category term="SharePoint Admin Center"/><category term="Term Store"/><category term="CAML"/><category term="List Template"/><category term="Office 365 Group"/><category term="Workflows"/><category term="Attachment"/><category term="Javascript"/><category term="Site Template"/><category term="UI Enhancement"/><category term="Backup/Restore"/><category term="Service Packs"/><category term="Content Editor Web Part"/><category term="Library"/><category term="Web Parts"/><category term="External Sharing"/><category term="My Site"/><category term="SharePoint Products Configuration Wizard"/><category term="Users"/><category term="External User"/><category term="Site Collection Administrator"/><category term="Visual Studio"/><category term="InfoPath"/><category term="List Item"/><category term="Audit"/><category term="Content Database"/><category term="Quotas and Locks"/><category term="Web Application"/><category term="Architecture / Planning"/><category term="Installation"/><category term="Access Request"/><category term="Apps"/><category term="Custom Action"/><category term="Event Receivers"/><category term="Master Page"/><category term="SharePoint Designer 2013"/><category term="Site Settings"/><category term="Solutions and Features"/><category term="Windows Server"/><category term="Anonymous Access"/><category term="Event Log"/><category term="Managed Path"/><category term="Nintex"/><category term="Patching"/><category term="Quick Launch"/><category term="Theme"/><category term="Web Services"/><category term="XML"/><category term="App Pool"/><category term="Integration"/><category term="Tenant"/><category term="Timer Job"/><category term="BCS"/><category term="Calculated Column"/><category term="FAQs"/><category term="Office Web Apps"/><category term="Survey"/><category term="ULS Log"/><category term="Groups"/><category term="Microsoft Teams"/><category term="Monitoring"/><category term="STSADM"/><category term="Shortcuts"/><category term="Debug"/><category term="Fusion Charts"/><category term="Nintex Workflow"/><category term="PDF"/><category term="Performance Optimization"/><category term="PnP Provisioning"/><category term="Presentations"/><category term="SharePoint Basics"/><category term="Governance"/><category term="Health Analyzer"/><category term="Host-named Site Collection"/><category term="Modern Experience"/><category term="Page"/><category term="SSL Certificate"/><category term="SSRS"/><category term="SharePoint 2013 New Features"/><category term="SharePoint Foundation"/><category term="XSL"/><category term="Azure AD"/><category term="Dataview Webpart"/><category term="Farm"/><category term="JSOM"/><category term="Page Layouts"/><category term="Product Review"/><category term="Ribbon"/><category term="Sandboxed solutions"/><category term="User Control"/><category term="Browser Issues"/><category term="Client Side Rendering (CSR)"/><category term="Code Snippets"/><category term="Customization"/><category term="Email"/><category term="Excel Services"/><category term="List View Web Part"/><category term="Microsoft Flow"/><category term="REST"/><category term="Step By Step Guide"/><category term="Tools &amp; Utilities"/><category term="User Interface"/><category term="Validation"/><title type='text'>SharePoint Diary</title><subtitle type='html'>Salaudeen Rajack&#39;s SharePoint Experiences!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1889</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-7843112075225479810</id><published>2020-07-18T18:22:00.001+05:30</published><updated>2020-07-19T10:46:44.072+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Migration/Upgrade"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>Sync File Share to SharePoint Online using PowerShell</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Sync Fileshare to SharePoint Online using PowerShell.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-BV9gKjRTYg8/XxLwEtmgUII/AAAAAAAATDg/x7FUbrzzwxYHbRRe97WmAPIbjTyuNTx9QCLcBGAsYHQ/s850/sync%2Bfile%2Bshare%2Bto%2Bsharepoint%2Bonline%2Busing%2Bpowershell.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sync file share to sharepoint online document library using powershell&quot; border=&quot;0&quot; data-original-height=&quot;315&quot; data-original-width=&quot;850&quot; src=&quot;https://1.bp.blogspot.com/-BV9gKjRTYg8/XxLwEtmgUII/AAAAAAAATDg/x7FUbrzzwxYHbRRe97WmAPIbjTyuNTx9QCLcBGAsYHQ/d/sync%2Bfile%2Bshare%2Bto%2Bsharepoint%2Bonline%2Busing%2Bpowershell.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;PowerShell Script to Sync File share to SharePoint Online document Library: &lt;/b&gt;&lt;/div&gt;&lt;div&gt;While my other script &lt;a href=&quot;https://www.sharepointdiary.com/2018/01/migrate-file-share-to-sharepoint-online-using-powershell.html&quot;&gt;Migrate File Share to SharePoint Online using PowerShell &lt;/a&gt; imports files and folders from network file share to SharePoint Online, this script syncs file share to SharePoint Online document library. &lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;Import-Module SharePointPnPPowerShellOnline&lt;br /&gt;&lt;br /&gt;#Function to Import Files from Fileshare to SharePoint Online&lt;br /&gt;Function Import-FileShareToSPO&lt;br /&gt;{&lt;br /&gt; param&lt;br /&gt;    (&lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $SiteURL,&lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $SourceFolderPath,&lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $TargetLibraryName,            &lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $LogFile&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    Try {&lt;br /&gt;        Add-content $Logfile -value &quot;`n---------------------- Import FileShare Script Started: $(Get-date -format &#39;dd/MM/yyy hh:mm:ss tt&#39;)-------------------&quot;   &lt;br /&gt;    &lt;br /&gt;        #Get Number of Source Items from the Source Folder&lt;br /&gt;        $SourceItemsCount =  (Get-ChildItem -Path $SourceFolderPath -Recurse).count&lt;br /&gt;&lt;br /&gt;        #Get the Target Library to Upload&lt;br /&gt;        $Web = Get-PnPWeb&lt;br /&gt;        $Library = Get-PnPList $TargetLibraryName -Includes RootFolder&lt;br /&gt;        $TargetFolder = $Library.RootFolder&lt;br /&gt;&lt;br /&gt;        #Get the site relative path of the target Folder&lt;br /&gt;        If($web.ServerRelativeURL -eq &quot;/&quot;)&lt;br /&gt;        {&lt;br /&gt;            $TargetFolderSiteRelativeURL = $TargetFolder.ServerRelativeUrl&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {        &lt;br /&gt;            $TargetFolderSiteRelativeURL = $TargetFolder.ServerRelativeURL.Replace($Web.ServerRelativeUrl,&quot;&quot;) &lt;br /&gt;        }  &lt;br /&gt; &lt;br /&gt;        #Get All Items from the Source&lt;br /&gt;        $SourceItems = Get-ChildItem -Path $SourceFolderPath -Recurse&lt;br /&gt;        $Source = @($SourceItems | Select FullName,  PSIsContainer,&lt;br /&gt;                                     @{Label=&#39;TargetItemURL&#39;;Expression={$_.FullName.Replace($SourceFolderPath,$TargetFolderSiteRelativeURL).Replace(&quot;\&quot;,&quot;/&quot;)}}, &lt;br /&gt;                                            @{Label=&#39;LastUpdated&#39;;Expression={$_.LastWriteTimeUtc.ToString()}})&lt;br /&gt;&lt;br /&gt;        #Get All Files from the target document library - In batches of 2000&lt;br /&gt;        $TargetFiles = Get-PnPListItem -List $TargetLibraryName -PageSize 2000&lt;br /&gt;        $Target = @($TargetFiles | Select @{Label=&#39;FullName&#39;;Expression={$_.FieldValues.FileRef.Replace($TargetFolder.ServerRelativeURL,$SourceFolderPath).Replace(&quot;/&quot;,&quot;\&quot;)}},&lt;br /&gt;                                                @{Label=&#39;PSIsContainer&#39;;Expression={$_.FileSystemObjectType -eq &quot;Folder&quot;}},&lt;br /&gt;                                                    @{Label=&#39;TargetItemURL&#39;;Expression={$_.FieldValues.FileRef.Replace($Web.ServerRelativeUrl,&quot;&quot;)}},&lt;br /&gt;                                                        @{Label=&#39;LastUpdated&#39;;Expression={$_.FieldValues.Modified.ToUniversalTime().ToString()}})&lt;br /&gt;&lt;br /&gt;        #Compare Source and Target and upload/update files which are not in the target&lt;br /&gt;        $Counter = 1&lt;br /&gt;        $FilesDiff = Compare-Object -ReferenceObject $Source -DifferenceObject $Target -Property FullName, PSIsContainer, TargetItemURL, LastUpdated&lt;br /&gt;        #$FilesDiff | Export-csv -path &quot;C:\Temp\diff.csv&quot; -NoTypeInformation&lt;br /&gt;        $SourceDelta = @($FilesDiff | Where {$_.SideIndicator -eq &quot;&amp;lt;=&quot;}) &lt;br /&gt;        $SourceDeltaCount = $SourceDelta.Count&lt;br /&gt;&lt;br /&gt;        #Check if Source Files are changed&lt;br /&gt;        If($SourceDeltaCount -gt 0)&lt;br /&gt;        {&lt;br /&gt;            Write-host &quot;Found $SourceDeltaCount new differences in the Source!&quot; &lt;br /&gt;            Add-content $Logfile -value &quot;Found $SourceDeltaCount new differences in the Source!&quot;   &lt;br /&gt;    &lt;br /&gt;            $SourceDelta | Sort-Object TargetItemURL | ForEach-Object {&lt;br /&gt;                #Calculate Target Folder URL for the file&lt;br /&gt;                $TargetFolderURL = (Split-Path $_.TargetItemURL -Parent).Replace(&quot;\&quot;,&quot;/&quot;)&lt;br /&gt;                $ItemName = Split-Path $_.FullName -leaf&lt;br /&gt;                #Replace Invalid Characters&lt;br /&gt;                $ItemName = [RegEx]::Replace($ItemName, &quot;[{0}]&quot; -f ([RegEx]::Escape([String]&#39;\&quot;*:&amp;lt;&amp;gt;?/\|&#39;)), &#39;_&#39;)&lt;br /&gt;&lt;br /&gt;                #Display Progress bar&lt;br /&gt;                $Status  = &quot;Importing &#39;&quot; + $ItemName + &quot;&#39; to &quot; + $TargetFolderURL +&quot; ($($Counter) of $($SourceDeltaCount))&quot;&lt;br /&gt;                Write-Progress -Activity &quot;Importing Files from the Source...&quot; -Status $Status -PercentComplete (($Counter / $SourceDeltaCount) * 100)&lt;br /&gt;&lt;br /&gt;                If($_.PSIsContainer)&lt;br /&gt;                {&lt;br /&gt;                    #Ensure Folder&lt;br /&gt;                    $Folder  = Resolve-PnPFolder -SiteRelativePath ($TargetFolderURL+&quot;/&quot;+$ItemName) -Includes ListItemAllFields&lt;br /&gt;                    &lt;br /&gt;                    Set-PnPListItem -List $TargetLibraryName -Identity $Folder.ListItemAllFields.Id -Values @{&quot;Modified&quot;=  ([DateTime]$_.LastUpdated).ToLocalTime()} | Out-null&lt;br /&gt;                    Write-host &quot;Ensured Folder &#39;$($ItemName)&#39; to Folder $TargetFolderURL&quot;&lt;br /&gt;                    Add-content $Logfile -value &quot;Ensured Folder &#39;$($ItemName)&#39; to Folder $TargetFolderURL&quot;&lt;br /&gt;                }&lt;br /&gt;                Else&lt;br /&gt;                {&lt;br /&gt;                    #Upload File&lt;br /&gt;                    $File  = Add-PnPFile -Path $_.FullName -Folder $TargetFolderURL -Values @{&quot;Modified&quot;=  ([DateTime]$_.LastUpdated).ToLocalTime()}&lt;br /&gt;                    Write-host &quot;Ensured File &#39;$($_.FullName)&#39; to Folder $TargetFolderURL&quot;&lt;br /&gt;                    Add-content $Logfile -value &quot;Ensured File &#39;$($_.FullName)&#39; to Folder $TargetFolderURL&quot;&lt;br /&gt;                }&lt;br /&gt;                $Counter++&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-host &quot;Found no new Items in the Source! Total Items in Source: $SourceItemsCount , Number Items in Target: $($Library.Itemcount)&quot; &lt;br /&gt;            Add-content $Logfile -value &quot;Found no new Items in the Source! Items in Source: $SourceItemsCount ,  Number Items in Target: $($Library.Itemcount)&quot; &lt;br /&gt;        }      &lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        Write-host -f Red &quot;Error:&quot; $_.Exception.Message &lt;br /&gt;        Add-content $Logfile -value &quot;Error:$($_.Exception.Message)&quot;&lt;br /&gt;    }&lt;br /&gt;    Finally {&lt;br /&gt;       Add-content $Logfile -value &quot;---------------------- Import File Share Script Completed: $(Get-date -format &#39;dd/MM/yyy hh:mm:ss tt&#39;)-----------------&quot;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Function to Remove Files Delta in SharePoint Online (Files that are no longer exists in FileShare )&lt;br /&gt;Function Remove-FileShareDeltaInSPO&lt;br /&gt;{&lt;br /&gt; param&lt;br /&gt;    (&lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $SiteURL,&lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $SourceFolderPath,&lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $TargetLibraryName,            &lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $LogFile&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    Try {&lt;br /&gt;        Add-content $Logfile -value &quot;`n---------------------- Remove FileShare Delta Script Started: $(Get-date -format &#39;dd/MM/yyy hh:mm:ss tt&#39;)-------------------&quot;   &lt;br /&gt;&lt;br /&gt;        #Get Number of Source Items from the Source Folder&lt;br /&gt;        $SourceItemsCount =  (Get-ChildItem -Path $SourceFolderPath -Recurse).count&lt;br /&gt;&lt;br /&gt;        #Get the Target Library&lt;br /&gt;        $Web = Get-PnPWeb&lt;br /&gt;        $Library = Get-PnPList $TargetLibraryName -Includes RootFolder&lt;br /&gt;        $TargetFolder = $Library.RootFolder&lt;br /&gt;&lt;br /&gt;        #Get the site relative path of the target Folder&lt;br /&gt;        If($web.ServerRelativeURL -eq &quot;/&quot;)&lt;br /&gt;        {&lt;br /&gt;            $TargetFolderSiteRelativeURL = $TargetFolder.ServerRelativeUrl&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {        &lt;br /&gt;            $TargetFolderSiteRelativeURL = $TargetFolder.ServerRelativeURL.Replace($Web.ServerRelativeUrl,&quot;&quot;) &lt;br /&gt;        }        &lt;br /&gt; &lt;br /&gt;        #Get All Items from the Source&lt;br /&gt;        $SourceItems = Get-ChildItem -Path $SourceFolderPath -Recurse&lt;br /&gt;        $Source = @($SourceItems | Select FullName,  PSIsContainer,&lt;br /&gt;                                     @{Label=&#39;TargetItemURL&#39;;Expression={$_.FullName.Replace($SourceFolderPath,$TargetFolderSiteRelativeURL).Replace(&quot;\&quot;,&quot;/&quot;)}}, &lt;br /&gt;                                            @{Label=&#39;LastUpdated&#39;;Expression={$_.LastWriteTimeUtc.ToString()}})&lt;br /&gt;&lt;br /&gt;        #Get All Files from the target document library - In batches of 2000&lt;br /&gt;        $TargetFiles = Get-PnPListItem -List $TargetLibraryName -PageSize 2000&lt;br /&gt;        $Target = @($TargetFiles | Select @{Label=&#39;FullName&#39;;Expression={$_.FieldValues.FileRef.Replace($TargetFolder.ServerRelativeURL,$SourceFolderPath).Replace(&quot;/&quot;,&quot;\&quot;)}},&lt;br /&gt;                                                @{Label=&#39;PSIsContainer&#39;;Expression={$_.FileSystemObjectType -eq &quot;Folder&quot;}},&lt;br /&gt;                                                    @{Label=&#39;TargetItemURL&#39;;Expression={$_.FieldValues.FileRef.Replace($Web.ServerRelativeUrl,&quot;&quot;)}},&lt;br /&gt;                                                        @{Label=&#39;LastUpdated&#39;;Expression={$_.FieldValues.Modified.ToUniversalTime().ToString()}})&lt;br /&gt;&lt;br /&gt;        #Compare Source and Target and remove files which are not in the Source&lt;br /&gt;        $Counter = 1&lt;br /&gt;        $FilesDiff = Compare-Object -ReferenceObject $Source -DifferenceObject $Target -Property FullName, PSIsContainer, TargetItemURL, LastUpdated     &lt;br /&gt;        $TargetDelta = @($FilesDiff | Where {$_.SideIndicator -eq &quot;=&amp;gt;&quot;})&lt;br /&gt;        $TargetDeltaCount = $TargetDelta.Count&lt;br /&gt;&lt;br /&gt;        #Check if Target Files Needs to be deleted&lt;br /&gt;        If($TargetDeltaCount -gt 0)&lt;br /&gt;        {&lt;br /&gt;            Write-host &quot;Found $TargetDeltaCount differences in the Target!&quot; &lt;br /&gt;            Add-content $Logfile -value &quot;Found $TargetDeltaCount differences in the Target!&quot;   &lt;br /&gt;    &lt;br /&gt;            $TargetDelta | Sort-Object TargetItemURL -Descending | ForEach-Object {&lt;br /&gt;                #Display Progress bar&lt;br /&gt;                $Status  = &quot;Removing Item &quot; + $_.TargetItemURL +&quot; ($($Counter) of $($TargetDeltaCount))&quot;&lt;br /&gt;                Write-Progress -Activity &quot;Removing Items in the Target...&quot; -Status $Status -PercentComplete (($Counter / $TargetDeltaCount) * 100)&lt;br /&gt;&lt;br /&gt;                If($_.PSIsContainer)&lt;br /&gt;                {&lt;br /&gt;                    #Empty and Remove the Folder&lt;br /&gt;                    $Folder  = Get-PnPFolder -Url $_.TargetItemURL -ErrorAction SilentlyContinue&lt;br /&gt;                    If($Folder -ne $Null)&lt;br /&gt;                    {&lt;br /&gt;                        $Folder.Recycle() | Out-Null&lt;br /&gt;                        Invoke-PnPQuery&lt;br /&gt;&lt;br /&gt;                        Write-host &quot;Removed Folder &#39;$($_.TargetItemURL)&#39;&quot;&lt;br /&gt;                        Add-content $Logfile -value &quot;Removed Folder &#39;$($_.TargetItemURL)&#39;&quot;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                Else&lt;br /&gt;                {&lt;br /&gt;                    $File = Get-PnPFile -Url $_.TargetItemURL -ErrorAction SilentlyContinue&lt;br /&gt;                    If($File -ne $Null)&lt;br /&gt;                    {&lt;br /&gt;                        #Remove the File&lt;br /&gt;                        Remove-PnPFile -SiteRelativeUrl $_.TargetItemURL -Force&lt;br /&gt;                        Write-host &quot;Removed File &#39;$($_.TargetItemURL)&#39;&quot;&lt;br /&gt;                        Add-content $Logfile -value &quot;Removed File &#39;$($_.TargetItemURL)&#39;&quot;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                $Counter++&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-host &quot;Found no diferences in the Target! Total Items in Source: $SourceItemsCount , Number Items in Target: $($Library.Itemcount)&quot; &lt;br /&gt;            Add-content $Logfile -value &quot;Found no differences in the Target! Items in Source: $SourceItemsCount ,  Number Items in Target: $($Library.Itemcount)&quot; &lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        Write-host -f Red &quot;Error:&quot; $_.Exception.Message &lt;br /&gt;        Add-content $Logfile -value &quot;Error:$($_.Exception.Message)&quot;&lt;br /&gt;    }&lt;br /&gt;    Finally {&lt;br /&gt;       Add-content $Logfile -value &quot;---------------------- Remove FileShare Delta Script Completed: $(Get-date -format &#39;dd/MM/yyy hh:mm:ss tt&#39;)-----------------&quot;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Function Sync-FileShareToSPO()&lt;br /&gt;{&lt;br /&gt; param&lt;br /&gt;    (&lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $SiteURL,&lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $SourceFolderPath,&lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $TargetLibraryName,            &lt;br /&gt;        [Parameter(Mandatory=$true)] [string] $LogFile&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    Try {&lt;br /&gt;        #Connect to PnP Online&lt;br /&gt;        Connect-PnPOnline -Url $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;        #Call the function to Import New Files from Fileshare to SPO&lt;br /&gt;        Import-FileShareToSPO -SiteURL $SiteURL -SourceFolderPath $SourceFolderPath -TargetLibraryName $TargetLibraryName -LogFile $LogFile&lt;br /&gt;&lt;br /&gt;        #Call the function to Remove Files in SPO that are moved/deleted in Fileshare&lt;br /&gt;        Remove-FileShareDeltaInSPO -SiteURL $SiteURL -SourceFolderPath $SourceFolderPath -TargetLibraryName $TargetLibraryName -LogFile $LogFile&lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        Write-host -f Red &quot;Error:&quot; $_.Exception.Message&lt;br /&gt;    }&lt;br /&gt;    Finally {&lt;br /&gt;       DisConnect-PnPOnline&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Call the Function to Sync Files from Fileshare to SharePoint Online&lt;br /&gt;Sync-FileShareToSPO -SiteURL &quot;https://crescent.sharepoint.com/sites/Projects&quot; -SourceFolderPath &quot;\\FileServer\Reports&quot; `&lt;br /&gt;                            -TargetLibraryName &quot;Documents&quot; -LogFile &quot;C:\Temp\SyncFileShare-LOG.log&quot;&lt;br /&gt;&lt;/pre&gt;This script checks the timestamp of each file from the given fileshare and uploads it to SharePoint Online if they are updated in File share. Similarly, any file deleted in Fileshare will be deleted in SharePoint Online as well. It generates a log file also every time it runs. Please note, this script does only one-way sync from Fileshare to SharePoint Online. You can &lt;a href=&quot;https://www.sharepointdiary.com/2013/03/create-scheduled-task-for-powershell-script.html&quot;&gt;Schedule PowerShell script in Windows Task scheduler &lt;/a&gt;, so that it runs on schedule. E.g. for every 10 min. &lt;br /&gt;&lt;br /&gt;You can also use this script to sync files from local drive to SharePoint by changing the SourceFolderPath parameter to any folder in your computer. E.g. &quot;C:\Temp\Upload&quot; </content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/7843112075225479810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/07/sync-file-share-to-sharepoint-online-using-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/7843112075225479810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/7843112075225479810'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/07/sync-file-share-to-sharepoint-online-using-powershell.html' title='Sync File Share to SharePoint Online using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-2004156137830392256</id><published>2020-06-11T14:04:00.011+05:30</published><updated>2020-07-19T21:38:22.497+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Office 365"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>Disable Mass Delete Email Notification &quot;Heads up! We noticed that you recently deleted a large number of files from a site&quot; in SharePoint Online</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Disable the alert Email notification &quot;Heads up! We noticed that you recently deleted a large number of files from a site&quot; in SharePoint Online.&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When you delete files and folders in bulk, SharePoint Online triggers the following Email to the tenant administrators and the user who deleted files to tell about the deleted files and how to recover the files from the Recycle Bin. This feature proactively alerts users when a large number of  files are deleted in SharePoint Online or OneDrive for Business.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&quot;Heads up! We noticed that you recently deleted a large number of files from a site&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span style=&quot;color: #505050; font-family: &amp;quot;segoe ui semibold&amp;quot; , sans-serif; font-size: 18pt; font-weight: normal;&quot;&gt;Files are permanently removed from the online recycle bin 93 days after they&#39;re deleted &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #505050;&quot;&gt;&lt;span style=&quot;font-size: 24px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&quot;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-zWp4gJ6X2fU/Xv7q0T1tCKI/AAAAAAAAS5U/e4kHqqAr3bw3hQ_3wUAaxkZ53DEo45HQgCK4BGAsYHg/s1379/Heads%2Bup%2521%2BWe%2Bnoticed%2Bthat%2Byou%2Brecently%2Bdeleted%2Ba%2Blarge%2Bnumber%2Bof%2Bfiles%2Bfrom%2Ba%2Bsite.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Heads up! We noticed that you recently deleted a large number of files from a site&quot; border=&quot;0&quot; data-original-height=&quot;1089&quot; data-original-width=&quot;1379&quot; src=&quot;https://1.bp.blogspot.com/-zWp4gJ6X2fU/Xv7q0T1tCKI/AAAAAAAAS5U/e4kHqqAr3bw3hQ_3wUAaxkZ53DEo45HQgCK4BGAsYHg/d/Heads%2Bup%2521%2BWe%2Bnoticed%2Bthat%2Byou%2Brecently%2Bdeleted%2Ba%2Blarge%2Bnumber%2Bof%2Bfiles%2Bfrom%2Ba%2Bsite.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;How to Disable Bulk Delete Email Alerts in SharePoint Online?&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;This Email is causing confusion when users move files as they are get picked up as being deleted. So we wanted to turn-off these alerts. These email notifications are triggers from by the alert policy called &quot;Unusual volume of file deletion&quot; which is enabled by default in your Office 365 tenant. You can turn it off by following below steps:&lt;/div&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Login to Office 365 Admin Center &amp;gt;&amp;gt; Open &quot;Security &amp;amp; Compliance&quot; center&lt;/li&gt;&lt;li&gt;Click on &quot;Alert Policies&quot; (URL: &lt;a href=&quot;https://protection.office.com/alertpolicies&quot; target=&quot;_blank&quot;&gt;https://protection.office.com/alertpolicies&lt;/a&gt;), &lt;/li&gt;&lt;li&gt;Search and find the  alert policy called &quot;Unusual volume of file deletion&quot; and click on the policy to edit.&lt;/li&gt;&lt;li&gt;Now, you can disable the policy by setting the status to &quot;Off&quot;. &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-UJbNAfEHBqA/XxQVAuFIhiI/AAAAAAAATDw/T7AoxZFk3-ozenjwU09q-XGQat3vWIEcACLcBGAsYHQ/s1195/disable%2Bunusual%2Bvolume%2Bof%2Bfile%2Bdeletion%2Balert%2Bpolicy.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;disable unusual volume of file deletion alert policy&quot; border=&quot;0&quot; data-original-height=&quot;809&quot; data-original-width=&quot;1195&quot; src=&quot;https://1.bp.blogspot.com/-UJbNAfEHBqA/XxQVAuFIhiI/AAAAAAAATDw/T7AoxZFk3-ozenjwU09q-XGQat3vWIEcACLcBGAsYHQ/d/disable%2Bunusual%2Bvolume%2Bof%2Bfile%2Bdeletion%2Balert%2Bpolicy.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;This disables any further email notifications. You can also edit the policy to configure recipients of the Emails, disable notifications, etc. so that alerts will still be triggered and logged in the  Admin Center for auditing purposes, but users won&#39;t receive any Email notifications. &lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Further information about these policies can be found in the article:&lt;a href=&quot;https://docs.microsoft.com/en-us/microsoft-365/compliance/alert-policies?view=o365-worldwide&quot; target=&quot;_blank&quot;&gt; https://docs.microsoft.com/en-us/microsoft-365/compliance/alert-policies?view=o365-worldwide&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/2004156137830392256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/06/disable-mass-delete-email-notification-in-sharepoint-online.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/2004156137830392256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/2004156137830392256'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/06/disable-mass-delete-email-notification-in-sharepoint-online.html' title='Disable Mass Delete Email Notification &quot;Heads up! We noticed that you recently deleted a large number of files from a site&quot; in SharePoint Online'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-8196378475622256180</id><published>2020-04-20T01:15:00.002+05:30</published><updated>2020-04-26T22:06:08.804+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Admin Reports"/><category scheme="http://www.blogger.com/atom/ns#" term="File"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>SharePoint Online: Find All Files Exceeding Maximum URL Length Limitation using PowerShell</title><content type='html'>Microsoft Office Excel files stored in deep Folder, sub-folder structures with long names often result in an error when they exceed the maximum file URL length of 218 characters as in my other article&amp;nbsp; &lt;a href=&quot;https://www.sharepointdiary.com/2019/06/sharepoint-online-url-length-limitation-in-excel-files-218-characters.html&quot;&gt;SharePoint Online: URL Length Limitation of 218 Characters in Excel Files&lt;/a&gt;. So, we wanted to proactively scan the entire SharePoint Online environment for Excel files with long URLs.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-b8jHNF2HbQw/Xp1ajlf7CBI/AAAAAAAARog/GSPjIKunwn0muq9XdiuqfMTSvhafoYUvwCLcBGAsYHQ/s1600/The%2Bfile%2Bcould%2Bnot%2Bbe%2Baccessed.%2BTry%2Bone%2Bof%2Bthe%2Bfollowing.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Find Files Exceeding Maximum URL Length Limitation in SharePoint Online using PowerShell&quot; border=&quot;0&quot; data-original-height=&quot;160&quot; data-original-width=&quot;637&quot; src=&quot;https://1.bp.blogspot.com/-b8jHNF2HbQw/Xp1ajlf7CBI/AAAAAAAARog/GSPjIKunwn0muq9XdiuqfMTSvhafoYUvwCLcBGAsYHQ/s1600/The%2Bfile%2Bcould%2Bnot%2Bbe%2Baccessed.%2BTry%2Bone%2Bof%2Bthe%2Bfollowing.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;PowerShell to Get All Excel Files that Exceeds Maximum Character Limit URL&lt;/b&gt;&lt;br /&gt;This PowerShell script scans Excel files in all document libraries in a given site collection, Checks if any file URL length is greater than the given limit and export output report to a CSV format.&lt;b&gt; &lt;/b&gt;&lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking&lt;br /&gt;&lt;br /&gt;#Function to scan all files with long file names in a site&lt;br /&gt;Function Scan-SPOLongFilePath($SiteURL)&lt;br /&gt;{   &lt;br /&gt;    Try {&lt;br /&gt;        #Setup the context&lt;br /&gt;        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)&lt;br /&gt;        $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)&lt;br /&gt; &lt;br /&gt;        #Get the web from given URL and its subsites&lt;br /&gt;        $Web = $Ctx.web&lt;br /&gt;        $Ctx.Load($Web)&lt;br /&gt;        $Ctx.Load($Web.Lists)&lt;br /&gt;        $Ctx.Load($web.Webs)&lt;br /&gt;        $Ctx.executeQuery()&lt;br /&gt;         &lt;br /&gt;        #Arry to Skip System Lists and Libraries&lt;br /&gt;        $SystemLists = @(&quot;Converted Forms&quot;, &quot;Master Page Gallery&quot;, &quot;Customized Reports&quot;, &quot;Form Templates&quot;, &quot;List Template Gallery&quot;, &quot;Theme Gallery&quot;,&lt;br /&gt;                            &quot;Reporting Templates&quot;, &quot;Solution Gallery&quot;, &quot;Style Library&quot;, &quot;Web Part Gallery&quot;,&quot;Site Assets&quot;, &quot;wfpub&quot;, &quot;Site Pages&quot;, &quot;Images&quot;)&lt;br /&gt;     &lt;br /&gt;        Write-host -f Yellow &quot;Processing Site: $SiteURL&quot;&lt;br /&gt; &lt;br /&gt;        #Filter Document Libraries to Scan &lt;br /&gt;        $Lists = $Web.Lists | Where {$_.BaseType -eq &quot;DocumentLibrary&quot; -and $_.Hidden -eq $false -and $SystemLists -notcontains $_.Title}&lt;br /&gt;        #Loop through each document library&lt;br /&gt;        Foreach ($List in $Lists)&lt;br /&gt;        {&lt;br /&gt;            #Get All Files of Given File type from the document library - Excluding Folders&lt;br /&gt;            $Query =  New-Object Microsoft.SharePoint.Client.CamlQuery&lt;br /&gt;            $CAMLQuery =  &quot;&amp;lt;View Scope=&#39;RecursiveAll&#39;&amp;gt;&amp;lt;Query&amp;gt;&amp;lt;Where&amp;gt;&amp;lt;And&amp;gt;&amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name=&#39;FSObjType&#39; /&amp;gt;&amp;lt;Value Type=&#39;Integer&#39;&amp;gt;0&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name=&#39;File_x0020_Type&#39; /&amp;gt;&amp;lt;Value Type=&#39;Text&#39;&amp;gt;$FileExtension&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&amp;lt;/And&amp;gt;&amp;lt;/Where&amp;gt;&amp;lt;/Query&amp;gt;&amp;lt;/View&amp;gt;&quot;&lt;br /&gt;            $Query.ViewXml = $CAMLQuery&lt;br /&gt;            $ListItems= $List.GetItems($Query)&lt;br /&gt;            $Ctx.Load($ListItems)&lt;br /&gt;            $Ctx.ExecuteQuery() &lt;br /&gt;            &lt;br /&gt;            If($ListItems.count -gt 0)&lt;br /&gt;            {&lt;br /&gt;                Write-host -f Cyan &quot;`t Processing Document Library: &#39;$($List.Title)&#39;, Auditing $($ListItems.Count) Item(s)&quot;&lt;br /&gt; &lt;br /&gt;                $DocumentInventory = @()&lt;br /&gt;                #Iterate through each file and get data&lt;br /&gt;                Foreach($Item in $ListItems)&lt;br /&gt;                {&lt;br /&gt;                    $File = $Item.File&lt;br /&gt;                    $Ctx.Load($File)&lt;br /&gt;                    $Ctx.ExecuteQuery()&lt;br /&gt;&lt;br /&gt;                    #calculate the Absolute encoded URL of the File&lt;br /&gt;                    If($Web.ServerRelativeUrl -eq &quot;/&quot;)&lt;br /&gt;                    {&lt;br /&gt;                        $AbsoluteURL=  $(&quot;{0}{1}&quot; -f $Web.Url, $ListItem.FieldValues[&quot;FileRef&quot;])&lt;br /&gt;                    }&lt;br /&gt;                    else&lt;br /&gt;                    {&lt;br /&gt;                        $AbsoluteURL=  $(&quot;{0}{1}&quot; -f $Web.Url.Replace($Web.ServerRelativeUrl,&#39;&#39;), $Item.FieldValues[&quot;FileRef&quot;])&lt;br /&gt;                    }&lt;br /&gt;                    $AbsoluteURL = [uri]::EscapeUriString($AbsoluteURL)&lt;br /&gt;&lt;br /&gt;                    If($AbsoluteURL.length -gt $MaxUrlLength)&lt;br /&gt;                    {&lt;br /&gt;                        Write-host &quot;`t`tFound a Long File URL at &#39;$AbsoluteURL&#39;&quot; -f Green&lt;br /&gt;                        #Collect document data&lt;br /&gt;                        $DocumentData = New-Object PSObject&lt;br /&gt;                        $DocumentData | Add-Member NoteProperty SiteURL($SiteURL)&lt;br /&gt;                        $DocumentData | Add-Member NoteProperty DocLibraryName($List.Title)&lt;br /&gt;                        $DocumentData | Add-Member NoteProperty FileName($File.Name)&lt;br /&gt;                        $DocumentData | Add-Member NoteProperty FileURL($AbsoluteURL)&lt;br /&gt;                        $DocumentData | Add-Member NoteProperty CreatedBy($Item[&quot;Author&quot;].Email)&lt;br /&gt;                        $DocumentData | Add-Member NoteProperty CreatedOn($File.TimeCreated)&lt;br /&gt;                        $DocumentData | Add-Member NoteProperty ModifiedBy($Item[&quot;Editor&quot;].Email)&lt;br /&gt;                        $DocumentData | Add-Member NoteProperty LastModifiedOn($File.TimeLastModified)&lt;br /&gt;                        $DocumentData | Add-Member NoteProperty Size-KB([math]::Round($File.Length/1KB))&lt;br /&gt;&lt;br /&gt;                        #Add the result to an Array&lt;br /&gt;                        $DocumentInventory += $DocumentData&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                #Export the result to CSV file&lt;br /&gt;                $DocumentInventory | Export-CSV $ReportOutput -NoTypeInformation -Append&lt;br /&gt;            }&lt;br /&gt;        }  &lt;br /&gt;        #Iterate through all subsites of the current site&lt;br /&gt;        ForEach ($Subweb in $Web.Webs)&lt;br /&gt;        {&lt;br /&gt;            #Call the function recursively&lt;br /&gt;            Scan-SPOLongFilePath($Subweb.url)&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        write-host -f Red &quot;Error Scaning Document Library Inventory!&quot; $_.Exception.Message&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Set Parameters&lt;br /&gt;$SiteURL= &quot;https://crescent.sharepoint.com/sites/Marketing&quot;&lt;br /&gt;$ReportOutput=&quot;C:\temp\LongFileNames.csv&quot;&lt;br /&gt;$FileExtension = &quot;xlsx&quot;&lt;br /&gt;$MaxUrlLength = 259&lt;br /&gt;&lt;br /&gt;#Get Credentials to connect&lt;br /&gt;$Cred = Get-Credential&lt;br /&gt;&lt;br /&gt;#Delete the Output Report if exists&lt;br /&gt;If (Test-Path $ReportOutput) { Remove-Item $ReportOutput }&lt;br /&gt;&lt;br /&gt;#Call the function &lt;br /&gt;Scan-SPOLongFilePath $SiteURL&lt;/pre&gt;For lists and libraries with &amp;lt; 5000 items, this script works absolutely fine. Let&#39;s re-code in in PnP PowerShell.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PnP PowerShell to Audit SharePoint Online Site Collection for Long URLs&lt;/b&gt;&lt;br /&gt;This PnP PowerShell script scans the given site collection for long files and folders, and exports its findings to a CSV file. &lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$SiteURL = &quot;https://Crescent.SharePoint.com/sites/docs&quot;&lt;br /&gt;$MaxUrlLength = 218&lt;br /&gt;$CSVPath = &quot;C:\Temp\LongURLInventory.csv&quot;&lt;br /&gt;$global:LongURLInventory = @()&lt;br /&gt;$Pagesize = 2000&lt;br /&gt; &lt;br /&gt;#Get Credentials to connect&lt;br /&gt;#$Credential = Get-Credential&lt;br /&gt;   &lt;br /&gt;#Function to scan and collect long files&lt;br /&gt;Function Get-PnPLongURLInventory&lt;br /&gt;{&lt;br /&gt;    [cmdletbinding()]&lt;br /&gt;    param([parameter(Mandatory = $true, ValueFromPipeline = $true)] $Web)&lt;br /&gt; &lt;br /&gt;    Write-host &quot;Scanning Files with Long URL in Site &#39;$($Web.URL)&#39;&quot; -f Yellow&lt;br /&gt;    If($Web.ServerRelativeUrl -eq &quot;/&quot;)&lt;br /&gt;    {&lt;br /&gt;        $TenantURL= $Web.Url&lt;br /&gt;    }&lt;br /&gt;    Else&lt;br /&gt;    {&lt;br /&gt;        $TenantURL= $Web.Url.Replace($Web.ServerRelativeUrl,&#39;&#39;)&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    #Get All Large Lists from the Web - Exclude Hidden and certain lists&lt;br /&gt;    $ExcludedLists = @(&quot;Form Templates&quot;, &quot;Preservation Hold Library&quot;,&quot;Site Assets&quot;, &quot;Pages&quot;, &quot;Site Pages&quot;, &quot;Images&quot;,&lt;br /&gt;                            &quot;Site Collection Documents&quot;, &quot;Site Collection Images&quot;,&quot;Style Library&quot;) &lt;br /&gt;                             &lt;br /&gt;    #Get All Document Libraries from the Web&lt;br /&gt;    Get-PnPList -Web $Web -PipelineVariable List | Where-Object {$_.BaseType -eq &quot;DocumentLibrary&quot; -and $_.Hidden -eq $false -and $_.Title -notin $ExcludedLists -and $_.ItemCount -gt 0} | ForEach-Object {&lt;br /&gt;        #Get Items from List   &lt;br /&gt;        $global:counter = 0;&lt;br /&gt;        $ListItems = Get-PnPListItem -List $_ -Web $web -PageSize $Pagesize -Fields Author, Created, File_x0020_Type -ScriptBlock { Param($items) $global:counter += $items.Count; Write-Progress -PercentComplete ($global:Counter / ($_.ItemCount) * 100) -Activity &quot;Getting List Items of &#39;$($_.Title)&#39;&quot; -Status &quot;Processing Items $global:Counter to $($_.ItemCount)&quot;;}&lt;br /&gt;        $LongListItems = $ListItems | Where { ([uri]::EscapeUriString($_.FieldValues.FileRef).Length + $TenantURL.Length ) -gt $MaxUrlLength }&lt;br /&gt;        Write-Progress -Activity &quot;Completed Retrieving Items from List $($List.Title)&quot; -Completed&lt;br /&gt;                &lt;br /&gt;        If($LongListItems.count -gt 0)&lt;br /&gt;        {&lt;br /&gt;            #Get Root folder of the List&lt;br /&gt;            $Folder = Get-PnPProperty -ClientObject $_ -Property RootFolder&lt;br /&gt;            Write-host &quot;`tFound &#39;$($LongListItems.count)&#39; Items with Long URLs at &#39;$($Folder.ServerRelativeURL)&#39;&quot; -f Green&lt;br /&gt;&lt;br /&gt;            #Iterate through each long url item and collect data           &lt;br /&gt;            ForEach($ListItem in $LongListItems)&lt;br /&gt;            {&lt;br /&gt;                #Calculate Encoded Full URL of the File&lt;br /&gt;                $AbsoluteURL =  &quot;$TenantURL$($ListItem.FieldValues.FileRef)&quot;&lt;br /&gt;                $EncodedURL = [uri]::EscapeUriString($AbsoluteURL)&lt;br /&gt; &lt;br /&gt;                    #Collect document data&lt;br /&gt;                    $global:LongURLInventory += New-Object PSObject -Property ([ordered]@{&lt;br /&gt;                        SiteName  = $Web.Title&lt;br /&gt;                        SiteURL  = $Web.URL&lt;br /&gt;                        LibraryName = $List.Title&lt;br /&gt;                        LibraryURL = $Folder.ServerRelativeURL&lt;br /&gt;                        ItemName = $ListItem.FieldValues.FileLeafRef&lt;br /&gt;                        Type = $ListItem.FileSystemObjectType&lt;br /&gt;                        FileType = $ListItem.FieldValues.File_x0020_Type&lt;br /&gt;                        AbsoluteURL = $AbsoluteURL&lt;br /&gt;                        EncodedURL = $EncodedURL&lt;br /&gt;                        UrlLength = $EncodedURL.Length                      &lt;br /&gt;                        CreatedBy = $ListItem.FieldValues.Author.LookupValue&lt;br /&gt;                        CreatedByEmail  = $ListItem.FieldValues.Author.Email&lt;br /&gt;                        CreatedAt = $ListItem.FieldValues.Created&lt;br /&gt;                        ModifiedBy = $ListItem.FieldValues.Editor.LookupValue&lt;br /&gt;                        ModifiedByEmail = $ListItem.FieldValues.Editor.Email&lt;br /&gt;                        ModifiedAt = $ListItem.FieldValues.Modified                        &lt;br /&gt;                    })&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Connect to Site collection&lt;br /&gt;Connect-PnPOnline -Url $SiteURL -UseWebLogin&lt;br /&gt;  &lt;br /&gt;#Call the Function for Web &amp;amp; all Subwebs&lt;br /&gt;Get-PnPWeb | Get-PnPLongURLInventory&lt;br /&gt;Get-PnPSubWebs -Recurse| ForEach-Object { Get-PnPLongURLInventory $_ }&lt;br /&gt;Disconnect-PnPOnline&lt;br /&gt; &lt;br /&gt;#Export Documents Inventory to CSV&lt;br /&gt;$Global:LongURLInventory | Export-Csv $CSVPath -NoTypeInformation&lt;br /&gt;Write-host &quot;Report has been Exported to &#39;$CSVPath&#39;&quot;  -f Magenta&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;How about getting this inventory for SharePoint Online Tenant?&lt;/b&gt;&lt;br /&gt;This time, let&#39;s scan all files across all site collections in the entire tenant for all files with long file URLs.  &lt;br /&gt;&lt;div class=&quot;important&quot;&gt;Make sure you have Admin rights to all site collections in the tenant prior executing this script. Otherwise, you&#39;ll get access denied&amp;nbsp;&quot;The remote server returned an error: (403) Forbidden&quot; Error! &lt;a href=&quot;https://www.sharepointdiary.com/2015/08/sharepoint-online-add-site-collection-administrator-using-powershell.html&quot; target=&quot;_blank&quot;&gt;How to Add Site Collection Administrator to All Sites in SharePoint Online Tenant?&lt;/a&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$Domain =  &quot;crescent&quot; #Domain Name in SharePoint Online. E.g. https://Crescent.SharePoint.com&lt;br /&gt;$MaxUrlLength = 218&lt;br /&gt;$CSVFile = &quot;C:\Temp\LongURLInventory.csv&quot;&lt;br /&gt;$Pagesize = 2000&lt;br /&gt;&lt;br /&gt;#Frame Tenant URL and Tenant Admin URL&lt;br /&gt;$TenantURL = &quot;https://$Domain.SharePoint.com&quot;&lt;br /&gt;$TenantAdminURL = &quot;https://$Domain-Admin.SharePoint.com&quot;&lt;br /&gt;  &lt;br /&gt;#Function to scan and collect long files&lt;br /&gt;Function Get-PnPLongURLInventory&lt;br /&gt;{&lt;br /&gt;    [cmdletbinding()]&lt;br /&gt;    param([parameter(Mandatory = $true, ValueFromPipeline = $true)] $Web)&lt;br /&gt; &lt;br /&gt;    Write-host &quot;Scanning Files with Long URL in Site &#39;$($Web.URL)&#39;&quot; -f Yellow&lt;br /&gt;&lt;br /&gt;    #Get All Large Lists from the Web - Exclude Hidden and certain lists&lt;br /&gt;    $ExcludedLists = @(&quot;Form Templates&quot;, &quot;Preservation Hold Library&quot;,&quot;Site Assets&quot;, &quot;Pages&quot;, &quot;Site Pages&quot;, &quot;Images&quot;,&lt;br /&gt;                            &quot;Site Collection Documents&quot;, &quot;Site Collection Images&quot;,&quot;Style Library&quot;) &lt;br /&gt;                             &lt;br /&gt;    #Get All Document Libraries from the Web&lt;br /&gt;    Get-PnPList -Web $Web -Connection $SiteConn | Where-Object {$_.BaseType -eq &quot;DocumentLibrary&quot; -and $_.Hidden -eq $false -and $_.Title -notin $ExcludedLists -and $_.ItemCount -gt 0} | ForEach-Object {&lt;br /&gt;        #Get Items from List   &lt;br /&gt;        $global:counter = 0;&lt;br /&gt;        $LongURLInventory = @()&lt;br /&gt;        $ListItems = Get-PnPListItem -List $_ -Web $web -Connection $SiteConn -PageSize $Pagesize -Fields Author, Created, File_x0020_Type -ScriptBlock { Param($items) $global:counter += $items.Count; Write-Progress -PercentComplete ($global:Counter / ($_.ItemCount) * 100) -Activity &quot;Getting List Items of &#39;$($_.Title)&#39;&quot; -Status &quot;Processing Items $global:Counter to $($_.ItemCount)&quot;;}&lt;br /&gt;        $LongListItems = $ListItems | Where { ([uri]::EscapeUriString($_.FieldValues.FileRef).Length + $TenantURL.Length ) -gt $MaxUrlLength }                &lt;br /&gt;        If($LongListItems.count -gt 0)&lt;br /&gt;        {&lt;br /&gt;            #Get Root folder of the List&lt;br /&gt;            $Folder = Get-PnPProperty -ClientObject $_ -Property RootFolder&lt;br /&gt;            Write-host &quot;`tFound &#39;$($LongListItems.count)&#39; Item(s) with Long URLs at &#39;$($Folder.ServerRelativeURL)&#39;&quot; -f Green&lt;br /&gt;&lt;br /&gt;            #Iterate through each long url item and collect data           &lt;br /&gt;            ForEach($ListItem in $LongListItems)&lt;br /&gt;            {&lt;br /&gt;                #Calculate Encoded Full URL of the File&lt;br /&gt;                $AbsoluteURL =  &quot;$TenantURL$($ListItem.FieldValues.FileRef)&quot;&lt;br /&gt;                $EncodedURL = [uri]::EscapeUriString($AbsoluteURL)&lt;br /&gt; &lt;br /&gt;                    #Collect document data&lt;br /&gt;                    $LongURLInventory += New-Object PSObject -Property ([ordered]@{&lt;br /&gt;                        SiteName  = $Web.Title&lt;br /&gt;                        SiteURL  = $Web.URL&lt;br /&gt;                        LibraryName = $List.Title&lt;br /&gt;                        LibraryURL = $Folder.ServerRelativeURL&lt;br /&gt;                        ItemName = $ListItem.FieldValues.FileLeafRef&lt;br /&gt;                        Type = $ListItem.FileSystemObjectType&lt;br /&gt;                        FileType = $ListItem.FieldValues.File_x0020_Type&lt;br /&gt;                        AbsoluteURL = $AbsoluteURL&lt;br /&gt;                        EncodedURL = $EncodedURL&lt;br /&gt;                        UrlLength = $EncodedURL.Length                      &lt;br /&gt;                        CreatedBy = $ListItem.FieldValues.Author.LookupValue&lt;br /&gt;                        CreatedByEmail  = $ListItem.FieldValues.Author.Email&lt;br /&gt;                        CreatedAt = $ListItem.FieldValues.Created&lt;br /&gt;                        ModifiedBy = $ListItem.FieldValues.Editor.LookupValue&lt;br /&gt;                        ModifiedByEmail = $ListItem.FieldValues.Editor.Email&lt;br /&gt;                        ModifiedAt = $ListItem.FieldValues.Modified                        &lt;br /&gt;                    })&lt;br /&gt;                }&lt;br /&gt;                #Export Documents Inventory to CSV&lt;br /&gt;                $LongURLInventory | Export-Csv $CSVFile -NoTypeInformation -Append&lt;br /&gt;            }&lt;br /&gt;            Write-Progress -Activity &quot;Completed Exporting Long URL Items from List $($_.Title)&quot; -Completed&lt;br /&gt;        }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Connect to Admin Center&lt;br /&gt;Connect-PnPOnline -Url $TenantAdminURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;#Delete the Output report file if exists&lt;br /&gt;If (Test-Path $CSVFile) { Remove-Item $CSVFile }&lt;br /&gt;&lt;br /&gt;#Get All Site collections - Filter BOT and MySite Host&lt;br /&gt;$Sites = Get-PnPTenantSite -Filter &quot;Url -like &#39;$TenantURL&#39;&quot;&lt;br /&gt;  &lt;br /&gt;#Iterate through all site collections&lt;br /&gt;$Sites | ForEach-Object {&lt;br /&gt;    #Connect to each site collection&lt;br /&gt;    $SiteConn = Connect-PnPOnline -Url $_.URL -UseWebLogin -ReturnConnection&lt;br /&gt;  &lt;br /&gt;    #Call the Function for Web &amp;amp; all Subwebs&lt;br /&gt;    Get-PnPWeb -Connection $SiteConn | Get-PnPLongURLInventory&lt;br /&gt;    Get-PnPSubWebs -Recurse -Connection $SiteConn | ForEach-Object { Get-PnPLongURLInventory $_ }&lt;br /&gt;&lt;br /&gt;    Disconnect-PnPOnline -Connection $SiteConn&lt;br /&gt;}&lt;/pre&gt;Please note, Although the Microsoft documentation says its 218 characters, I found up to 259 works fine! </content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/8196378475622256180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/04/sharepoint-online-find-all-files-exceeding-maximum-url-length-using-powershell.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/8196378475622256180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/8196378475622256180'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/04/sharepoint-online-find-all-files-exceeding-maximum-url-length-using-powershell.html' title='SharePoint Online: Find All Files Exceeding Maximum URL Length Limitation using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-b8jHNF2HbQw/Xp1ajlf7CBI/AAAAAAAARog/GSPjIKunwn0muq9XdiuqfMTSvhafoYUvwCLcBGAsYHQ/s72-c/The%2Bfile%2Bcould%2Bnot%2Bbe%2Baccessed.%2BTry%2Bone%2Bof%2Bthe%2Bfollowing.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-8585781510168498489</id><published>2020-04-19T22:02:00.006+05:30</published><updated>2020-07-27T10:49:55.057+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="Quick Launch"/><category scheme="http://www.blogger.com/atom/ns#" term="Recycle Bin"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>SharePoint Online: Hide Recycle Bin from Quick Launch</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Hide Recycle bin from SharePoint Online Quick Launch&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-wKLcHcuLmg4/Xx3hQluFWMI/AAAAAAAATIE/2xCMnVtvMA0Baql4eGdYwnp_GQoJ5a_XQCLcBGAsYHQ/s1037/hide%2Brecycle%2Bbin%2Bin%2Bsharepoint%2Bonline.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;hide recycle bin in sharepoint online&quot; border=&quot;0&quot; data-original-height=&quot;663&quot; data-original-width=&quot;1037&quot; src=&quot;https://1.bp.blogspot.com/-wKLcHcuLmg4/Xx3hQluFWMI/AAAAAAAATIE/2xCMnVtvMA0Baql4eGdYwnp_GQoJ5a_XQCLcBGAsYHQ/d/hide%2Brecycle%2Bbin%2Bin%2Bsharepoint%2Bonline.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;How to Hide Recycle bin in SharePoint Online?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Recycle bin link was not relevant for site visitors as they can&#39;t delete from site or restore from Recycle bin and we wanted to hide the recycle bin from the Quick launch in SharePoint Online. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Case 1: Hide Recycle bin from quick launch in Classic SharePoint UI&lt;/b&gt;&lt;/div&gt;&lt;div&gt;If you are using classic experience sites in SharePoint Online sites, you can hide the recycle bin from quick launch of a particular page with this CSS. Just edit the page, Add a script editor web part and place this CSS in it.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-nuXA45SWDUc/Xx3cbitsY3I/AAAAAAAATH4/A4IItEdVzakRDA-BR-CWrfh5qR5PjFd_wCLcBGAsYHQ/s641/sharepoint%2Bonline%2Bhide%2Brecycle%2Bbin%2Bfrom%2Bquick%2Blaunch.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online hide recycle bin from quick launch&quot; border=&quot;0&quot; data-original-height=&quot;342&quot; data-original-width=&quot;641&quot; src=&quot;https://1.bp.blogspot.com/-nuXA45SWDUc/Xx3cbitsY3I/AAAAAAAATH4/A4IItEdVzakRDA-BR-CWrfh5qR5PjFd_wCLcBGAsYHQ/d/sharepoint%2Bonline%2Bhide%2Brecycle%2Bbin%2Bfrom%2Bquick%2Blaunch.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;CSS to hide hide recycle bin in SharePoint Online:&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;pre class=&quot;brush:css&quot;&gt;&amp;lt;style type=&quot;text/css&quot;&amp;gt;&lt;br /&gt;#sideNavBox a[title=&quot;Recycle Bin&quot;]&lt;br /&gt;{&lt;br /&gt;    display:none!important&lt;br /&gt;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;This hides the recycle bin link from quick launch navigation of a specific page. If you want to do it at the site level, you can either edit the master page and place the above CSS under:&lt;/div&gt;&lt;pre class=&quot;brush:html&quot;&gt;&amp;lt;asp:ContentPlaceHolder id=&quot;PlaceHolderAdditionalPageHead&quot; runat=&quot;server&quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;Otherwise, you can use &quot;Alternate CSS&quot; from Master page page settings of the site.&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Case 2: Remove Recycle bin from quick launch in  Modern SharePoint Online Sites&lt;/b&gt;&lt;br /&gt;If you have modern site, you can remove &quot;Recycle bin&quot; link from quick launch (or any link in left navigation) with the help of &quot;Navigation&quot; option of SharePoint publishing feature. First make sure you have Publishing server feature enabled at both Site collection and at site level.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Go to Site Settings &amp;gt;&amp;gt; Click on Site Collection Features &amp;gt;&amp;gt; Activate &quot;SharePoint Server Publishing Infrastructure&quot; feature. It takes a moment to activate the feature.&lt;/li&gt;&lt;li&gt;Once activated, Click on &quot;Site Features&quot; link from site settings &amp;gt;&amp;gt; Activate &quot;SharePoint Server Publishing&quot; feature.&lt;/li&gt;&lt;/ol&gt;Once the publishing feature is enabled, recycle bin is removed from the quick launch automatically! Similarly, you can hide any link such as &quot;Site Contents&quot; from SharePoint Online quick launch bar by:&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Go to Site settings &amp;gt;&amp;gt; Click on &quot;Navigation&quot; under &quot;Look and Feel&quot;&lt;/li&gt;&lt;li&gt;Now, you can select and delete any link from the current launch navigation. &lt;/li&gt;&lt;li&gt;Click the OK button to save the changes to the navigation.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-9jsm5MTn5Vo/Xx3h_i4y2sI/AAAAAAAATIM/E6YUYlMSoz04srwCXi0jy9rK_HJ-NpBMgCLcBGAsYHQ/s985/sharepoint%2Bonline%2Bremove%2Brecycle%2Bbin%2Bfrom%2Bquick%2Blaunch.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online remove recycle bin from quick launch&quot; border=&quot;0&quot; data-original-height=&quot;574&quot; data-original-width=&quot;985&quot; src=&quot;https://1.bp.blogspot.com/-9jsm5MTn5Vo/Xx3h_i4y2sI/AAAAAAAATIM/E6YUYlMSoz04srwCXi0jy9rK_HJ-NpBMgCLcBGAsYHQ/d/sharepoint%2Bonline%2Bremove%2Brecycle%2Bbin%2Bfrom%2Bquick%2Blaunch.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;That&#39;s all! The changes will be saved, and you will be returned to the Site Settings page.&lt;br /&gt;&lt;br /&gt;You can also add the link https://yourtenant.sharepoint.com/sites/your-site/_layouts/15/RecycleBin.aspx to the navigation and set audience targetting to show recycle bin only to specific user or group!&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/8585781510168498489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/04/sharepoint-online-hide-recycle-bin-from-quick-launch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/8585781510168498489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/8585781510168498489'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/04/sharepoint-online-hide-recycle-bin-from-quick-launch.html' title='SharePoint Online: Hide Recycle Bin from Quick Launch'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-1551721787812512741</id><published>2020-03-31T21:58:00.002+05:30</published><updated>2020-05-09T06:11:26.509+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>How to Promote a Site Page to News Post in SharePoint Online?</title><content type='html'>&lt;b&gt;Requirement:&lt;/b&gt; Convert Site Page into News post in SharePoint Online.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to Convert a Site Page into News Post in SharePoint Online?&lt;/b&gt;&lt;br /&gt;In modern SharePoint Online sites, any existing site page can be converted into the News page, so that it appears in News web parts. To promote a site page to News page, do the following:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Navigate to the site page &amp;gt;&amp;gt; Click on &quot;Promote&quot; button on the toolbar&lt;/li&gt;&lt;li&gt;Click on &quot;Post as News on this site&quot; button in the tool pane.&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-tHNiybNsPpk/XoNqqGiKKFI/AAAAAAAARgM/4Sv2llIq4V0V8YbArJM1M4eGFbbCjc_3gCLcBGAsYHQ/s1600/convert%2Bsite%2Bpage%2Binto%2Bnews%2Bpage.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;convert site page into news page&quot; border=&quot;0&quot; data-original-height=&quot;869&quot; data-original-width=&quot;1538&quot; src=&quot;https://1.bp.blogspot.com/-tHNiybNsPpk/XoNqqGiKKFI/AAAAAAAARgM/4Sv2llIq4V0V8YbArJM1M4eGFbbCjc_3gCLcBGAsYHQ/s1600/convert%2Bsite%2Bpage%2Binto%2Bnews%2Bpage.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;It&#39;s fairly easy to promote a normal site page, isn&#39;t it? Once promoted or demoted, You have to republish the page for the search engine to re-index! Otherwise, You may not find them under places like News hub.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SharePoint Online: Demote a News Post Into Site Page&lt;/b&gt;&lt;br /&gt;How about the reverse? demoting news page back to the site page to remove it from news pages? As there is no interface&lt;b&gt; &lt;/b&gt;to do this, we can get this done by PnP PowerShell. Setting the &quot;PromotedState&quot; field to &quot;0&quot; demotes the news page.&lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/Intranet&quot;&lt;br /&gt;&lt;br /&gt;#Connect to Site&lt;br /&gt;Connect-PnPOnline $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;#Get all Site pages - along with their IDs&lt;br /&gt;Get-PnPListItem -List &quot;SitePages&quot;&lt;br /&gt;&lt;br /&gt;#Demote News page with ID &quot;4&quot; to Site Page&lt;br /&gt;Set-PnPListItem -List &quot;SitePages&quot; -Identity 4 -Values @{&quot;PromotedState&quot;=&quot;0&quot;}&lt;br /&gt;&lt;/pre&gt;BTW, Promoted news posts have the value of &quot;2&quot; for PromotedState field.</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/1551721787812512741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/03/promote-site-page-to-news-page-in-sharepoint-online.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/1551721787812512741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/1551721787812512741'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/03/promote-site-page-to-news-page-in-sharepoint-online.html' title='How to Promote a Site Page to News Post in SharePoint Online?'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-tHNiybNsPpk/XoNqqGiKKFI/AAAAAAAARgM/4Sv2llIq4V0V8YbArJM1M4eGFbbCjc_3gCLcBGAsYHQ/s72-c/convert%2Bsite%2Bpage%2Binto%2Bnews%2Bpage.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-1110282516591083696</id><published>2020-03-28T18:36:00.006+05:30</published><updated>2020-08-02T11:03:52.149+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Library"/><category scheme="http://www.blogger.com/atom/ns#" term="List"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>SharePoint Online: How to Make a List Read-Only?</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Make a SharePoint Online list to read only.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;How to make a list read only in SharePoint Online?&lt;/b&gt;&lt;div&gt;Well, there is no direct way to set a SharePoint Online list to read-only. However, we can follow this workaround to make a list to read-only mode.&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Navigate to your SharePoint Online List &amp;gt;&amp;gt; Click on Settings gear and choose &quot;List Settings&quot;&lt;/li&gt;&lt;li&gt;Click on &quot;Permissions for this list&quot; link under &quot;Permissions and Management&quot; group of the list settings page.&lt;/li&gt;&lt;li&gt;Click on &quot;Stop Inheriting Permissions&quot; button in the ribbon and confirm the prompt, if the list is not with broken permissions already.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Select users and groups that has permissions other than read. E.g. Full Control, Edit, contribute, Etc. and click on &quot;Edit User Permissions&quot; button in the ribbon.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-5hsjhfgHde4/XyXMBg1NKXI/AAAAAAAATJs/vccTLVhdUXc4GFcgwID57JNttX5cF7YwQCLcBGAsYHQ/s1121/sharepoint%2Bonline%2Bmake%2Blist%2Bread%2Bonly.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online make list read only&quot; border=&quot;0&quot; data-original-height=&quot;625&quot; data-original-width=&quot;1121&quot; src=&quot;https://1.bp.blogspot.com/-5hsjhfgHde4/XyXMBg1NKXI/AAAAAAAATJs/vccTLVhdUXc4GFcgwID57JNttX5cF7YwQCLcBGAsYHQ/d/sharepoint%2Bonline%2Bmake%2Blist%2Bread%2Bonly.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;In the Edit Permissions page, Select &quot;Read&quot; permissions and Click on &quot;OK&quot; to reset everyone&#39;s permission to &quot;Read&quot;.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-2hf9PUcfLpY/XyXMMbQzjCI/AAAAAAAATJw/jnkvlx2mGg4plFyLAg0wjJaQgNcNg8tUwCLcBGAsYHQ/s1254/set%2Bsharepoint%2Bonline%2Blist%2Bread-only.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;set sharepoint online list read-only&quot; border=&quot;0&quot; data-original-height=&quot;853&quot; data-original-width=&quot;1254&quot; src=&quot;https://1.bp.blogspot.com/-2hf9PUcfLpY/XyXMMbQzjCI/AAAAAAAATJw/jnkvlx2mGg4plFyLAg0wjJaQgNcNg8tUwCLcBGAsYHQ/d/set%2Bsharepoint%2Bonline%2Blist%2Bread-only.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;PowerShell to make a list read only in SharePoint Online&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Lets automate above steps to make a SharePoint Online list or library to read only.&lt;br /&gt;&lt;b&gt; &lt;/b&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameter&lt;br /&gt;$SiteURL = &quot;https://Crescent.sharepoint.com/sites/PMO&quot;&lt;br /&gt;$ListName= &quot;Projects&quot;&lt;br /&gt; &lt;br /&gt;#Connect to PnP Online&lt;br /&gt;Connect-PnPOnline -Url $SiteURL -UseWebLogin&lt;br /&gt; &lt;br /&gt;#Get the Web and List&lt;br /&gt;$Web = Get-PnPWeb&lt;br /&gt;$List = Get-PnPList -Identity $ListName -Includes HasUniqueRoleAssignments, RoleAssignments&lt;br /&gt;&lt;br /&gt;#Break Permissions of the List&lt;br /&gt;If ($List.HasUniqueRoleAssignments -eq $False)&lt;br /&gt;{&lt;br /&gt;    Set-PnPList -Identity $ListName -BreakRoleInheritance -CopyRoleAssignments&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;#Get Read Permission Level&lt;br /&gt;$ReadPermission = Get-PnPRoleDefinition -Identity &quot;Read&quot;&lt;br /&gt;&lt;br /&gt;#Grant &quot;Read&quot; permissions, if its not granted already&lt;br /&gt;$List.RoleAssignments | ForEach-Object {&lt;br /&gt;    #Get the user or group of the assignment - Handle error for orphans&lt;br /&gt;    $Member = Get-PnPProperty -ClientObject $_ -Property Member -ErrorAction SilentlyContinue&lt;br /&gt;&lt;br /&gt;    If($Member.IsHiddenInUI -eq $False)&lt;br /&gt;    {&lt;br /&gt;        Get-PnPProperty -ClientObject $_ -Property RoleDefinitionBindings | Out-Null&lt;br /&gt; &lt;br /&gt;        #Check if the current assignment has any permission other than Read or related&lt;br /&gt;        $PermissionsToReplace = $_.RoleDefinitionBindings | Where {$_.Hidden -eq $False -And $_.Name -Notin (&quot;Read&quot;, &quot;Restricted Read&quot;, &quot;Restricted Interfaces for Translation&quot;)}&lt;br /&gt;        &lt;br /&gt;        #Grant &quot;Read&quot; permissions, if its not granted already&lt;br /&gt;        If($PermissionsToReplace -ne $Null)&lt;br /&gt;        {&lt;br /&gt;            $_.RoleDefinitionBindings.Add($ReadPermission)&lt;br /&gt;            $_.Update()&lt;br /&gt;            Invoke-PnPQuery&lt;br /&gt;            Write-host &quot;Added &#39;Read&#39; Permissions to &#39;$($Member.Title)&#39;&quot; -ForegroundColor Cyan&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;#Reload List permissions&lt;br /&gt;$List = Get-PnPList -Identity $ListName -Includes RoleAssignments&lt;br /&gt;&lt;br /&gt;#Remove All permissions other than Read or Similar&lt;br /&gt;$List.RoleAssignments | ForEach-Object {&lt;br /&gt;    #Get the user or group of the assignment - Handle error for orphans&lt;br /&gt;    $Member = Get-PnPProperty -ClientObject $_ -Property Member #-ErrorAction SilentlyContinue | Out-Null    &lt;br /&gt;    If($Member.IsHiddenInUI -eq $False)&lt;br /&gt;    {&lt;br /&gt;        Get-PnPProperty -ClientObject $_ -Property RoleDefinitionBindings | Out-Null&lt;br /&gt; &lt;br /&gt;        $PermissionsToRemove = $_.RoleDefinitionBindings | Where {$_.Hidden -eq $False -And $_.Name -Notin (&quot;Read&quot;, &quot;Restricted Read&quot;, &quot;Restricted Interfaces for Translation&quot;)}&lt;br /&gt;        If($PermissionsToRemove -ne $null)&lt;br /&gt;        {&lt;br /&gt;            ForEach($RoleDefBinding in $PermissionsToRemove)&lt;br /&gt;            {&lt;br /&gt;                $_.RoleDefinitionBindings.Remove($RoleDefBinding)&lt;br /&gt;                Write-host &quot;Removed &#39;$($RoleDefBinding.Name)&#39; Permissions from &#39;$($Member.Title)&#39;&quot; -ForegroundColor Yellow    &lt;br /&gt;            }&lt;br /&gt;            $_.Update()&lt;br /&gt;            Invoke-PnPQuery&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;Write-host &quot;List is set to Read-Only Successfully!&quot; -f Green&lt;br /&gt;&lt;/pre&gt;This PowerShell script resets all permissions with &quot;Read&quot;. Please note, These methods doesn&#39;t control Site Collection Administrators!&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/1110282516591083696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/03/sharepoint-online-make-list-read-only-using-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/1110282516591083696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/1110282516591083696'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/03/sharepoint-online-make-list-read-only-using-powershell.html' title='SharePoint Online: How to Make a List Read-Only?'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-1789370861799036182</id><published>2020-02-08T17:57:00.008+05:30</published><updated>2020-05-10T22:41:26.964+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft Teams"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>How to Convert SharePoint Online Site to Microsoft Teams?</title><content type='html'>&lt;b&gt;Requirement: &lt;/b&gt;Convert SharePoint Online Site to Microsoft Teams.&lt;br /&gt;&lt;br /&gt;Microsoft Teams is a chat-based collaboration platform that brings together people, conversations, content, and tools to create a more open, digital environment. Every time you create a new team in Teams, you&#39;re also creating a new Office 365 Group, Calendar, OneNote, Planner, SharePoint team site, etc. and ties into other Office 365 cloud applications. And for every channel you create in Teams, a folder within a SharePoint document library is automatically created. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to migrate SharePoint Online Site to Teams?&lt;/b&gt;&lt;br /&gt;You may have an existing SharePoint Online team site for a dedicated project or business function and using it to storing documents and communication and wants to take advantage from Microsoft Teams and here is how you can we can convert your existing SharePoint Online team sites into Microsoft Team so that the files from the existing document library can be accessed in Microsoft Teams.&lt;br /&gt;&lt;div class=&quot;important&quot;&gt;&lt;b&gt;Prerequisites:&lt;/b&gt; Your existing SharePoint Online site must be group connected to be able to integrate with Microsoft Teams! If it is not already, Its a matter of few clicks through settings menu link. Step by step instructions are here: &lt;a href=&quot;https://www.sharepointdiary.com/2019/01/connect-existing-team-sites-to-office-365-group.html&quot;&gt;How to Connect SharePoint Online site to Office 365 Group?&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Option 1: Create a Microsoft Team from an existing SharePoint site&lt;/b&gt;&lt;br /&gt;When you create a new modern SPO site with Office 365 Group, You&#39;ll see the Microsoft Teams prompt on the site home page. &lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Navigate to the home page of the existing SharePoint Online team site &amp;gt;&amp;gt; Click on Create a team from the Microsoft Teams prompt in the bottom left corner of the screen.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-A0HaVVy2OOo/XrVHLh5UiCI/AAAAAAAARy0/MYOdr_F-DjooHyPLt_6aXJAAsH8tJ9lngCK4BGAsYHg/create%2Bteam%2Bfrom%2BSharePoint%2BOnline%2Bsite.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;create team from SharePoint Online site&quot; border=&quot;0&quot; data-original-height=&quot;738&quot; data-original-width=&quot;1149&quot; src=&quot;https://1.bp.blogspot.com/-A0HaVVy2OOo/XrVHLh5UiCI/AAAAAAAARy0/MYOdr_F-DjooHyPLt_6aXJAAsH8tJ9lngCK4BGAsYHg/d/create%2Bteam%2Bfrom%2BSharePoint%2BOnline%2Bsite.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;It spins the wheel with &quot;Creating Team&quot; message for a while and you&#39;ll get &quot;Success! Click here to go to your Team&quot; message Once your team is created. Clicking on it will take you to the Microsoft Teams app, and you can start collaborating in your new associated team. Also, it adds the &quot;Teams&quot; menu to SharePoint left navigation.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-mXZtFXeNNUI/XrVHXnKOIUI/AAAAAAAARzA/-GsbQO6_4wsrvjUrvUvpgnx5tiqvhvsIgCK4BGAsYHg/microsoft%2Bteams%2Band%2Bsharepoint%2Bonline%2Bintegration.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;microsoft teams and sharepoint online integration&quot; border=&quot;0&quot; data-original-height=&quot;738&quot; data-original-width=&quot;1149&quot; src=&quot;https://1.bp.blogspot.com/-mXZtFXeNNUI/XrVHXnKOIUI/AAAAAAAARzA/-GsbQO6_4wsrvjUrvUvpgnx5tiqvhvsIgCK4BGAsYHg/d/microsoft%2Bteams%2Band%2Bsharepoint%2Bonline%2Bintegration.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b&gt;Option 2: Create Microsoft Teams from an existing SharePoint Site using Teams App&lt;/b&gt;&lt;br /&gt;What if you have closed the &quot;Create a Team&quot; popup already in your SharePoint Site? Well, you can convert the SharePoint Online site to Teams with Microsoft Teams application. Here is how:&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Open Microsoft Teams Client application from your desktop &amp;gt;&amp;gt; Click on &quot;Join or create a team&quot; link from the bottom of the Teams client application.  &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-QgflVW8IKeI/XrVHltq7NyI/AAAAAAAARzQ/K2z2pMAJQr8E6VUY9AQlLP_4qB2fMxPAQCK4BGAsYHg/Convert%2BSharePoint%2BOnline%2BSite%2Bto%2BMicrosoft%2BTeams.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Convert SharePoint Online Site to Microsoft Teams&quot; border=&quot;0&quot; data-original-height=&quot;769&quot; data-original-width=&quot;1175&quot; src=&quot;https://1.bp.blogspot.com/-QgflVW8IKeI/XrVHltq7NyI/AAAAAAAARzQ/K2z2pMAJQr8E6VUY9AQlLP_4qB2fMxPAQCK4BGAsYHg/d/Convert%2BSharePoint%2BOnline%2BSite%2Bto%2BMicrosoft%2BTeams.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Click on the &quot;Create Team&quot; button under Join or create a team page &amp;gt;&amp;gt; Choose &quot;Create from...&quot; An existing Office 365 group or team &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-mpOZJELWjO4/XrVH5HDf9YI/AAAAAAAARzw/1xNzDx4Szq0auUf1IrYsxm44zpQA7MopgCK4BGAsYHg/link%2Bsharepoint%2Bonline%2Bto%2Bteams.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;link sharepoint online to teams&quot; border=&quot;0&quot; data-original-height=&quot;769&quot; data-original-width=&quot;1175&quot; src=&quot;https://1.bp.blogspot.com/-mpOZJELWjO4/XrVH5HDf9YI/AAAAAAAARzw/1xNzDx4Szq0auUf1IrYsxm44zpQA7MopgCK4BGAsYHg/d/link%2Bsharepoint%2Bonline%2Bto%2Bteams.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Click on &quot;Office 365 group&quot;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-0n7xXLwY9aQ/XrVICAbygRI/AAAAAAAAR0E/A05TJ0v3m04nqaTva3tRwP-FTmiVvJ4xACK4BGAsYHg/convert%2Bsharepoint%2Bonline%2Bsite%2Bto%2Bteams.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;convert sharepoint online site to teams&quot; border=&quot;0&quot; data-original-height=&quot;769&quot; data-original-width=&quot;1175&quot; src=&quot;https://1.bp.blogspot.com/-0n7xXLwY9aQ/XrVICAbygRI/AAAAAAAAR0E/A05TJ0v3m04nqaTva3tRwP-FTmiVvJ4xACK4BGAsYHg/d/convert%2Bsharepoint%2Bonline%2Bsite%2Bto%2Bteams.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Select the Office 365 group of your existing SharePoint site and then click on the &quot;Create&quot; button.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-Gq2URILinUU/XrVIJPULVEI/AAAAAAAAR0U/Nmd0pVvnXwQpzOkO1vtnmkHAatem0tcYwCK4BGAsYHg/migrate%2Bsharepoint%2Bonline%2Bto%2Bteams.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;migrate sharepoint online to teams&quot; border=&quot;0&quot; data-original-height=&quot;769&quot; data-original-width=&quot;1175&quot; src=&quot;https://1.bp.blogspot.com/-Gq2URILinUU/XrVIJPULVEI/AAAAAAAAR0U/Nmd0pVvnXwQpzOkO1vtnmkHAatem0tcYwCK4BGAsYHg/d/migrate%2Bsharepoint%2Bonline%2Bto%2Bteams.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;and your Teams should be ready shortly! &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Option 3: Create Teams from SharePoint Online using PowerShell: &lt;/b&gt;&lt;br /&gt;We can migrate SharePoint Online site using PowerShell as well. Make sure you have Teams PowerShell module installed prior to running this script: &lt;a href=&quot;https://www.sharepointdiary.com/2019/07/connect-to-microsoft-teams-with-powershell.html&quot; target=&quot;_blank&quot;&gt;How to Install Microsoft Teams PowerShell Module?&lt;/a&gt; &lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking&lt;br /&gt;&lt;br /&gt;$AdminCenterURL = &quot;https://crescent-admin.sharepoint.com&quot;&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/legal&quot;&lt;br /&gt;&lt;br /&gt;#Get Credentials to connect&lt;br /&gt;$Cred = Get-Credential&lt;br /&gt;&lt;br /&gt;#Connect to SharePoint Online&lt;br /&gt;Connect-SPOService -Url $AdminCenterURL -Credential $Cred&lt;br /&gt;&lt;br /&gt;#Connect to Microsoft Teams&lt;br /&gt;Connect-MicrosoftTeams -Credential $Cred&lt;br /&gt;&lt;br /&gt;#Get the Site collection&lt;br /&gt;$Site = Get-SPOSite -Identity $SiteURL&lt;br /&gt;&lt;br /&gt;#Create Teams from the SharePoint Site&lt;br /&gt;New-Team -GroupId $Site.GroupId.Guid&lt;/pre&gt;&lt;div class=&quot;info&quot;&gt;Creating Teams from SharePoint Online Site doesn&#39;t replace it with teams! Instead, it connects them together for better collaboration! These steps only &quot;Team enable&quot; an existing SharePoint site. You can continue using it as usual.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/1789370861799036182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/02/convert-sharepoint-online-site-to-teams.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/1789370861799036182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/1789370861799036182'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/02/convert-sharepoint-online-site-to-teams.html' title='How to Convert SharePoint Online Site to Microsoft Teams?'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-6313948051091852499</id><published>2020-02-05T23:25:00.014+05:30</published><updated>2020-08-06T16:38:38.180+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Admin Reports"/><category scheme="http://www.blogger.com/atom/ns#" term="Permission"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><category scheme="http://www.blogger.com/atom/ns#" term="Subsite"/><title type='text'>SharePoint Online: Get Subsite Permission Report using PowerShell</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement:&lt;/b&gt; PowerShell script to get subsite permissions in SharePoint Online.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;How to Get Subsite Permissions in SharePoint Online?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;To get permissions of a SharePoint Online subsite,&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Click on Setting gear &amp;gt;&amp;gt; Click on &quot;Site Permissions&quot; link&lt;/li&gt;&lt;li&gt;Click on &quot;Advanced Permission Settings&quot; in the site permissions page&lt;/li&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-fnLXdp3PymE/XyrNlCY5_GI/AAAAAAAATKo/9eNdVaPaVdIaB8LDa8MWyVEPYDM6NCJQQCLcBGAsYHQ/s1168/sharepoint%2Bonline%2Bpowershell%2Bsubsite%2Bpermissions.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online powershell subsite permissions&quot; border=&quot;0&quot; data-original-height=&quot;737&quot; data-original-width=&quot;1168&quot; src=&quot;https://1.bp.blogspot.com/-fnLXdp3PymE/XyrNlCY5_GI/AAAAAAAATKo/9eNdVaPaVdIaB8LDa8MWyVEPYDM6NCJQQCLcBGAsYHQ/d/sharepoint%2Bonline%2Bpowershell%2Bsubsite%2Bpermissions.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/ul&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;This gives you a all users and groups that has permissions to the subsite.&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;SharePoint Online: PowerShell to Get Subsite Permissions&lt;/b&gt;&lt;/div&gt;&lt;div&gt;This PowerShell script extracts and exports all direct permissions of the given subsite  (not any underlying objects such as list, folder, file) .&lt;br /&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/Marketing/2020&quot;&lt;br /&gt;$ReportOutput = &quot;C:\Temp\SitePermissionRpt.csv&quot;&lt;br /&gt;&lt;br /&gt;#Connect to Site&lt;br /&gt;Connect-PnPonline -Url $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;#Get the web&lt;br /&gt;$Web = Get-PnPWeb -Includes RoleAssignments&lt;br /&gt;&lt;br /&gt;#Loop through each permission assigned and extract details&lt;br /&gt;$PermissionData = @()&lt;br /&gt;ForEach ($RoleAssignment in $Web.RoleAssignments)&lt;br /&gt;{&lt;br /&gt;    #Get the Permission Levels assigned and Member&lt;br /&gt;    Get-PnPProperty -ClientObject $RoleAssignment -Property RoleDefinitionBindings, Member&lt;br /&gt;    &lt;br /&gt;    #Get the Permission Levels assigned&lt;br /&gt;    $PermissionLevels = ($RoleAssignment.RoleDefinitionBindings | Select -ExpandProperty Name | Where {$_ -ne &quot;Limited Access&quot;}) -join &quot;,&quot;&lt;br /&gt;    $PermissionType = $RoleAssignment.Member.PrincipalType&lt;br /&gt;&lt;br /&gt;    #Leave Principals with no Permissions&lt;br /&gt;    If($PermissionLevels.Length -eq 0) {Continue}&lt;br /&gt;    &lt;br /&gt;    #Collect Permission Data&lt;br /&gt;    $Permissions = New-Object PSObject&lt;br /&gt;    $Permissions | Add-Member NoteProperty Name($RoleAssignment.Member.Title)&lt;br /&gt;    $Permissions | Add-Member NoteProperty Type($PermissionType)&lt;br /&gt;    $Permissions | Add-Member NoteProperty PermissionLevels($PermissionLevels)&lt;br /&gt;    $PermissionData += $Permissions&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$PermissionData&lt;br /&gt;$PermissionData | Export-csv -path $ReportOutput -NoTypeInformation&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;This script gets all permissions from the subsite and generates a CSV as:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-WrnbzeHyrTg/XyrPnHrTW_I/AAAAAAAATK0/_h04viZ1jOs8bmmJ01gxar-9EK4WSXoCQCLcBGAsYHQ/s705/sharepoint%2Bonline%2Bsubsite%2Bpermission%2Breport%2Busing%2Bpowershell.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online subsite permission report using powershell&quot; border=&quot;0&quot; data-original-height=&quot;325&quot; data-original-width=&quot;705&quot; src=&quot;https://1.bp.blogspot.com/-WrnbzeHyrTg/XyrPnHrTW_I/AAAAAAAATK0/_h04viZ1jOs8bmmJ01gxar-9EK4WSXoCQCLcBGAsYHQ/d/sharepoint%2Bonline%2Bsubsite%2Bpermission%2Breport%2Busing%2Bpowershell.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;While this script extracts permissions applied on the subsite, what if you want to get members of each group along with the direct permissions to the site?&lt;br /&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/Marketing/2020&quot;&lt;br /&gt;$ReportOutput = &quot;C:\Temp\SitePermissionRpt.csv&quot;&lt;br /&gt;&lt;br /&gt;#Connect to Site&lt;br /&gt;Connect-PnPonline -Url $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;#Get the web&lt;br /&gt;$Web = Get-PnPWeb -Includes RoleAssignments&lt;br /&gt;&lt;br /&gt;#Loop through each permission assigned and extract details&lt;br /&gt;$PermissionData = @()&lt;br /&gt;ForEach ($RoleAssignment in $Web.RoleAssignments)&lt;br /&gt;{&lt;br /&gt;    #Get the Permission Levels assigned and Member&lt;br /&gt;    Get-PnPProperty -ClientObject $RoleAssignment -Property RoleDefinitionBindings, Member&lt;br /&gt;    &lt;br /&gt;    #Get the Permission Levels assigned&lt;br /&gt;    $PermissionLevels = ($RoleAssignment.RoleDefinitionBindings | Select -ExpandProperty Name | Where { $_ -ne &quot;Limited Access&quot;} ) -join &quot;,&quot;&lt;br /&gt;    &lt;br /&gt;    #Leave Principals with no Permissions&lt;br /&gt;    If($PermissionLevels.Length -eq 0) {Continue}&lt;br /&gt;&lt;br /&gt;    $PermissionType = $RoleAssignment.Member.PrincipalType&lt;br /&gt;    #Get SharePoint group members&lt;br /&gt;    If($PermissionType -eq &quot;SharePointGroup&quot;)&lt;br /&gt;    {&lt;br /&gt;        #Get Group Members&lt;br /&gt;        $GroupMembers = Get-PnPGroupMembers -Identity $RoleAssignment.Member.LoginName&lt;br /&gt;                  &lt;br /&gt;        #Leave Empty Groups&lt;br /&gt;        If($GroupMembers.count -eq 0){ Continue }&lt;br /&gt;        $GroupUsers = ($GroupMembers | Select -ExpandProperty LoginName | Where { $_ -ne &quot;SHAREPOINT\system&quot;}) -join &quot;; &quot;&lt;br /&gt;  &lt;br /&gt;        #Add the Data to Object&lt;br /&gt;        $Permissions = New-Object PSObject&lt;br /&gt;        $Permissions | Add-Member NoteProperty Name($RoleAssignment.Member.Title)&lt;br /&gt;        $Permissions | Add-Member NoteProperty Accounts($GroupUsers)&lt;br /&gt;        $Permissions | Add-Member NoteProperty Type($PermissionType)&lt;br /&gt;        $Permissions | Add-Member NoteProperty PermissionLevels($PermissionLevels)&lt;br /&gt;        $PermissionData += $Permissions&lt;br /&gt;    }&lt;br /&gt;    Else&lt;br /&gt;    {&lt;br /&gt;        #Add the Data to Object&lt;br /&gt;        $Permissions = New-Object PSObject&lt;br /&gt;        $Permissions | Add-Member NoteProperty Name($RoleAssignment.Member.Title)&lt;br /&gt;        $Permissions | Add-Member NoteProperty Accounts($RoleAssignment.Member.LoginName)&lt;br /&gt;        $Permissions | Add-Member NoteProperty Type($PermissionType)&lt;br /&gt;        $Permissions | Add-Member NoteProperty PermissionLevels($PermissionLevels)&lt;br /&gt;        $PermissionData += $Permissions&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Export Permissions data to CSV file&lt;br /&gt;$PermissionData | Export-csv -path $ReportOutput -NoTypeInformation&lt;br /&gt;&lt;/pre&gt;This script gets all the users, SharePoint groups and members of the SharePoint Online site or subsite along with the permissions assigned to them. </content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/6313948051091852499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/08/sharepoint-online-get-subsite-permission-using-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/6313948051091852499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/6313948051091852499'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/08/sharepoint-online-get-subsite-permission-using-powershell.html' title='SharePoint Online: Get Subsite Permission Report using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-2569163432332448920</id><published>2020-02-04T21:26:00.004+05:30</published><updated>2020-08-04T21:46:27.848+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>Navigate to Site File System in SharePoint Online using PowerShell</title><content type='html'>&lt;div&gt;Do you know you can navigate to site file system using SharePoint Online from PowerShell? Well, Here is how it works:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Create a Mapped Drive for SharePoint Online site or Library&lt;/b&gt;&lt;/div&gt;&lt;div&gt;To start with, we&#39;ve to map SharePoint Online library as a drive from PowerShell using &lt;a href=&quot;https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/new-psdrive?view=powershell-7&quot; target=&quot;_blank&quot;&gt;New-PSDrive&lt;/a&gt; cmdlet.&lt;br /&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Variable &lt;br /&gt;$LibraryPath = &quot;\\crescentintranet.sharepoint.com@SSL\DavwwwRoot\Sites\marketing&quot;&lt;br /&gt; &lt;br /&gt;#Virtually map SharePoint Online Folder as PSDrive&lt;br /&gt;New-PSDrive -name &quot;M&quot; -Root $LibraryPath -PSProvider filesystem&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;This doesn&#39;t appear in File explorer, But you can access it through PowerShell. You can also create a persistent drive with -Persist switch.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Access Mapped Drive through PowerShell&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Once the library or site is mapped as network drive, you can start navigating to the site file system and manipulate it. E.g. Let&#39;s copy a folder with its content in a SharePoint Online document library.&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Switch to Mapped Drive&lt;br /&gt;M:&lt;br /&gt;&lt;br /&gt;#Change Current Directory to &quot;Branding&quot; Folder&lt;br /&gt;CD Branding&lt;br /&gt;&lt;br /&gt;#Get the contents of the Folder&lt;br /&gt;Dir&lt;br /&gt;&lt;br /&gt;#Copy a Folder with its contents&lt;br /&gt;Copy 2019 -Destination 2020 -Recurse&lt;br /&gt;&lt;/pre&gt; &lt;b&gt;&lt;/b&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Here is the entire flow:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-bcj6bQ4H08s/XymGsA2L12I/AAAAAAAATKc/736BRjYEH64hwNIJwHJJ_KzYq-mCbXwUwCLcBGAsYHQ/s844/navigate%2Bsite%2Bfile%2Bsystem%2Busing%2Bsharepoint%2Bonline%2Bpowershell.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;navigate site file system using sharepoint online powershell&quot; border=&quot;0&quot; data-original-height=&quot;574&quot; data-original-width=&quot;844&quot; src=&quot;https://1.bp.blogspot.com/-bcj6bQ4H08s/XymGsA2L12I/AAAAAAAATKc/736BRjYEH64hwNIJwHJJ_KzYq-mCbXwUwCLcBGAsYHQ/d/navigate%2Bsite%2Bfile%2Bsystem%2Busing%2Bsharepoint%2Bonline%2Bpowershell.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/2569163432332448920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/02/navigate-site-file-system-in-sharepoint-using-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/2569163432332448920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/2569163432332448920'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/02/navigate-site-file-system-in-sharepoint-using-powershell.html' title='Navigate to Site File System in SharePoint Online using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-8574191532280645308</id><published>2020-02-01T14:59:00.000+05:30</published><updated>2020-07-25T15:27:50.137+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Client Side Object Model (CSOM)"/><category scheme="http://www.blogger.com/atom/ns#" term="CSV"/><category scheme="http://www.blogger.com/atom/ns#" term="List"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>SharePoint Online: Update List Items from a CSV File using PowerShell</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Update SharePoint Online List from a CSV using PowerShell.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;PowerShell to Update SharePoint Online List from CSV File&lt;/b&gt;&lt;/div&gt;&lt;div&gt;We have a list called &quot;Projects&quot; with a bunch of columns and wanted to update items from a CSV file. Here is the PowerShell CSOM script to update SharePoint Online list from CSV:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-yaeCqiR0Uf8/XxwA5vY3qDI/AAAAAAAATHk/dOJWzqCuAiIj4XDSbH8e5ngX-H91govGQCLcBGAsYHQ/s1600/update%2Bsharepoint%2Blist%2Bfrom%2Bcsv.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;update sharepoint list from csv&quot; border=&quot;0&quot; data-original-height=&quot;128&quot; data-original-width=&quot;584&quot; src=&quot;https://1.bp.blogspot.com/-yaeCqiR0Uf8/XxwA5vY3qDI/AAAAAAAATHk/dOJWzqCuAiIj4XDSbH8e5ngX-H91govGQCLcBGAsYHQ/s1600/update%2Bsharepoint%2Blist%2Bfrom%2Bcsv.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;PowerShell Script to Update List Items from CSV:&lt;/b&gt;&lt;br /&gt;Set parameters in the script, make sure CSV columns are mapped with the respective field internal name with your SharePoint Online list and then run the script:&lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Load SharePoint CSOM Assemblies&lt;br /&gt;Add-Type -Path &quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll&quot;&lt;br /&gt;Add-Type -Path &quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll&quot;&lt;br /&gt;&lt;br /&gt;#Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/PMO&quot;&lt;br /&gt;$ListName= &quot;Projects&quot;&lt;br /&gt;$CSVFile = &quot;C:\Temp\ListData.csv&quot;&lt;br /&gt;&lt;br /&gt;#Setup Credentials to connect&lt;br /&gt;$Cred = Get-Credential&lt;br /&gt; &lt;br /&gt;Try {&lt;br /&gt;    #Get the data from CSV file&lt;br /&gt;    $CSVData = Import-CSV $CSVFile&lt;br /&gt;&lt;br /&gt;    #Setup the context&lt;br /&gt;    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)&lt;br /&gt;    $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)&lt;br /&gt; &lt;br /&gt;    #Get the List&lt;br /&gt;    $List = $Ctx.Web.Lists.GetByTitle($ListName)&lt;br /&gt;    $Ctx.Load($List)&lt;br /&gt;    $Ctx.ExecuteQuery()&lt;br /&gt;&lt;br /&gt;    #Loop through each Row in the CSV file and update the matching list item based on &quot;ID&quot;&lt;br /&gt;    ForEach($Row in $CSVData)&lt;br /&gt;    {&lt;br /&gt;        Try {&lt;br /&gt;            #Get list item to update&lt;br /&gt;            $ListItem = $List.GetItemById($Row.ID)&lt;br /&gt;            $Ctx.Load($ListItem)&lt;br /&gt;            $Ctx.ExecuteQuery()&lt;br /&gt;&lt;br /&gt;            #Update List Item&lt;br /&gt;            $ListItem[&quot;ProjectName&quot;] = $Row.&#39;Project Name&#39;&lt;br /&gt;            $ListItem[&quot;IsActive&quot;] = $Row.&#39;Is Active&#39;&lt;br /&gt;            $ListItem[&quot;Start_x0020_Date&quot;] = $Row.&#39;Start Date&#39;&lt;br /&gt;            $ListItem[&quot;Status&quot;] = $Row.&#39;Status&#39;&lt;br /&gt;            $ListItem.Update()&lt;br /&gt;            Write-host &quot;Updated List Item:&quot;$Row.ID&lt;br /&gt;        }&lt;br /&gt;        Catch {&lt;br /&gt;            write-host &quot;Error Updating Item $($Row.ID): $($_.Exception.InnerException.Message)&quot; -foregroundcolor Yellow&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;Catch {&lt;br /&gt;    write-host &quot;Error: $($_.Exception.Message)&quot; -foregroundcolor Red&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;This script works for simple field types such as Single line of text, Multiple lines of text, Date and Time, Yes/No, etc. What if you have a very large list with complex field types such as Person or Group, Hyperlink or Picture, Managed Metadata, Lookup and you have to update the list items from a CSV using PowerShell. Here is my list to update:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-G0PuWF5JGXY/XxmCl5PX8DI/AAAAAAAATGg/Ln8LbmlX1Aox3LXEEVYVCYmQklrKXcNVwCLcBGAsYHQ/s1600/update%2Bsharepoint%2Bonline%2Blist%2Bitems%2Bfrom%2Bcsv.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;update sharepoint online list items from csv&quot; border=&quot;0&quot; data-original-height=&quot;612&quot; data-original-width=&quot;1316&quot; src=&quot;https://1.bp.blogspot.com/-G0PuWF5JGXY/XxmCl5PX8DI/AAAAAAAATGg/Ln8LbmlX1Aox3LXEEVYVCYmQklrKXcNVwCLcBGAsYHQ/s1600/update%2Bsharepoint%2Bonline%2Blist%2Bitems%2Bfrom%2Bcsv.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;List structure:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-XUjTgGwhul8/Xxl-mf-63EI/AAAAAAAATGM/Lky8E98w_TE26qzlKBbZyYMQFg270bIYACLcBGAsYHQ/s944/update%2Bsharepoint%2Bonline%2Blist%2Bfrom%2Bcsv.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;update sharepoint online list from csv&quot; border=&quot;0&quot; data-original-height=&quot;463&quot; data-original-width=&quot;944&quot; src=&quot;https://1.bp.blogspot.com/-XUjTgGwhul8/Xxl-mf-63EI/AAAAAAAATGM/Lky8E98w_TE26qzlKBbZyYMQFg270bIYACLcBGAsYHQ/d/update%2Bsharepoint%2Bonline%2Blist%2Bfrom%2Bcsv.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;My CSV File with data to update:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-SDZuBOsgiKE/Xxl-rEtx0FI/AAAAAAAATGQ/Zxj49bXZWtEElIElIsR7RPFwJDiaWjUXwCLcBGAsYHQ/s1454/powershell%2Bupdate%2Bsharepoint%2Bonline%2Blist%2Bfrom%2Bcsv.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;powershell update sharepoint online list from csv&quot; border=&quot;0&quot; data-original-height=&quot;557&quot; data-original-width=&quot;1454&quot; src=&quot;https://1.bp.blogspot.com/-SDZuBOsgiKE/Xxl-rEtx0FI/AAAAAAAATGQ/Zxj49bXZWtEElIElIsR7RPFwJDiaWjUXwCLcBGAsYHQ/d/powershell%2Bupdate%2Bsharepoint%2Bonline%2Blist%2Bfrom%2Bcsv.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can download this CSV file here: &lt;a href=&quot;https://sites.google.com/site/salaudeenar/ListData.csv?attredirects=0&amp;amp;d=1&quot; target=&quot;_blank&quot;&gt;CSV to Update SharePoint Online List&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;PowerShell script to Update List Items from CSV:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Just set the parameters, make sure the data in the right format as in the CSV file. List items are updated with the matching ID field value from the given CSV file.&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Config Variables&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/Projects&quot;&lt;br /&gt;$ListName = &quot;Projects&quot;&lt;br /&gt;$CSVFilePath = &quot;C:\Temp\ProjectData.csv&quot;&lt;br /&gt;&lt;br /&gt;#Function to get Lookup ID from Lookup Value&lt;br /&gt;Function Get-LookupID($ListName, $LookupFieldName, $LookupValue)&lt;br /&gt;{&lt;br /&gt;    #Get Parent Lookup List and Field from Child Lookup Field&#39;s Schema XML&lt;br /&gt;    $LookupField =  Get-PnPField -List $ListName -Identity $LookupFieldName&lt;br /&gt;    [Xml]$Schema = $LookupField.SchemaXml&lt;br /&gt;    $ParentListID = $Schema.Field.Attributes[&quot;List&quot;].&#39;#text&#39;&lt;br /&gt;    $ParentField  = $Schema.field.Attributes[&quot;ShowField&quot;].&#39;#text&#39;&lt;br /&gt;    $ParentLookupItem  = Get-PnPListItem -List $ParentListID -Fields $ParentField | Where {$_[$ParentField] -eq $LookupValue} | Select -First 1&lt;br /&gt; &lt;br /&gt;    If($ParentLookupItem -ne $Null)&lt;br /&gt;    {&lt;br /&gt;        #Get the Parent Item ID&lt;br /&gt;        Return $ParentLookupItem[&quot;ID&quot;]&lt;br /&gt;    }&lt;br /&gt;    Else&lt;br /&gt;    {&lt;br /&gt;        Return $Null&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Try {&lt;br /&gt;    #Connect to the Site&lt;br /&gt;    Connect-PnPOnline -URL $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;    #Get the data from CSV file&lt;br /&gt;    $CSVData = Import-CSV $CSVFilePath&lt;br /&gt;&lt;br /&gt;    #Get the List&lt;br /&gt;    $List = Get-PnPList -Identity $ListName&lt;br /&gt;    &lt;br /&gt;    #Get fields to Update from the List - Skip Read only, hidden fields, content type and attachments&lt;br /&gt;    $ListFields = Get-PnPField -List $ListName | Where { (-Not ($_.ReadOnlyField)) -and (-Not ($_.Hidden)) -and ($_.InternalName -ne  &quot;ContentType&quot;) -and ($_.InternalName -ne  &quot;Attachments&quot;) }&lt;br /&gt;     &lt;br /&gt;    #Loop through each Row in the CSV file and update the matching list item ID&lt;br /&gt;    ForEach($Row in $CSVData)&lt;br /&gt;    {&lt;br /&gt;        #Get the List Item to update&lt;br /&gt;        $ListItem = Get-PnPListItem -List $List -Id $Row.ID -ErrorAction SilentlyContinue&lt;br /&gt;        If($ListItem -ne $Null)&lt;br /&gt;        {&lt;br /&gt;            $ItemValue = @{}            &lt;br /&gt;            $CSVFields = $Row | Get-Member -MemberType NoteProperty | Select -ExpandProperty Name&lt;br /&gt;            #Map each field from CSV to target list&lt;br /&gt;            Foreach($CSVField in $CSVFields)&lt;br /&gt;            {&lt;br /&gt;                $MappedField = $ListFields | Where {$_.InternalName -eq $CSVField}&lt;br /&gt;                If($MappedField -ne $Null)&lt;br /&gt;                {&lt;br /&gt;                    $FieldName = $MappedField.InternalName&lt;br /&gt;                    #Check if the Field value is not Null&lt;br /&gt;                    If($Row.$CSVField -ne $Null)&lt;br /&gt;                    {&lt;br /&gt;                        #Handle Special Fields&lt;br /&gt;                        $FieldType  = $MappedField.TypeAsString &lt;br /&gt;                        If($FieldType -eq &quot;User&quot; -or $FieldType -eq &quot;UserMulti&quot;) #People Picker Field&lt;br /&gt;                        {&lt;br /&gt;                            $PeoplePickerValues = $Row.$FieldName.Split(&quot;,&quot;)&lt;br /&gt;                            $ItemValue.add($FieldName,$PeoplePickerValues)&lt;br /&gt;                        }&lt;br /&gt;                        ElseIf($FieldType -eq &quot;Lookup&quot; -or $FieldType -eq &quot;LookupMulti&quot;) #Lookup Field&lt;br /&gt;                        {&lt;br /&gt;                            $LookupIDs = $Row.$FieldName.Split(&quot;,&quot;) | ForEach-Object { Get-LookupID -ListName $ListName -LookupFieldName $FieldName -LookupValue $_ }                &lt;br /&gt;                            $ItemValue.Add($FieldName,$LookupIDs)&lt;br /&gt;                        }&lt;br /&gt;                        Else&lt;br /&gt;                        {&lt;br /&gt;                            #Get Source Field Value and add to Hashtable&lt;br /&gt;                            $ItemValue.Add($FieldName,$Row.$FieldName)&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            Write-host &quot;Updating List item ID $($Row.ID) with value:&quot; &lt;br /&gt;            $ItemValue | Format-Table&lt;br /&gt;            #Update List Item value&lt;br /&gt;            Set-PnPListItem -List $ListName -Identity $Row.ID -Values $ItemValue | Out-Null&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-host &quot;Could not find item ID $($Row.ID) in the list, Skipped!&quot; -f Yellow&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;Catch {&lt;br /&gt;    write-host &quot;Error: $($_.Exception.Message)&quot; -foregroundcolor Red&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt; &lt;div class=&quot;note&quot;&gt;Note: Make sure your CSV column names are exactly matching with the list column internal names. &lt;/div&gt;&lt;br /&gt;Please note, this script updates existing list items from a given CSV file. If you want to import (add new items) from a CSV file, use: &lt;a href=&quot;https://www.sharepointdiary.com/2015/09/import-csv-file-to-sharepoint-list-using-powershell.html&quot;&gt; SharePoint Online: Import CSV File into SharePoint List using PowerShell&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/8574191532280645308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/07/sharepoint-online-update-list-items-from-csv-file-using-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/8574191532280645308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/8574191532280645308'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/07/sharepoint-online-update-list-items-from-csv-file-using-powershell.html' title='SharePoint Online: Update List Items from a CSV File using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-yaeCqiR0Uf8/XxwA5vY3qDI/AAAAAAAATHk/dOJWzqCuAiIj4XDSbH8e5ngX-H91govGQCLcBGAsYHQ/s72-c/update%2Bsharepoint%2Blist%2Bfrom%2Bcsv.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-216870942048828587</id><published>2020-01-30T00:26:00.020+05:30</published><updated>2020-07-23T13:24:17.785+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="List Settings"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>SharePoint Online: How to Change Required Field Settings in a List or Library?</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement:&lt;/b&gt; Set required fields in SharePoint Online list or document library.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;How to Set Required Fields in SharePoint Online?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Required fields setting in SharePoint Online lists and libraries help to ensure that users enter certain information when saving items or uploading files. You can configure any field as a required field in SharePoint - or change a field to not be required. By default, Certain fields are marked as &quot;Required&quot; in SharePoint. E.g. For custom lists - Title field is required.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can mark a field as required either while creating a new column or editing existing column in SharePoint Online list or document library by settings the configuration &quot;Require that this column contains information&quot; to &quot;Yes&quot;.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-oJC51mRZl1w/Xxc_wJXWzKI/AAAAAAAATFM/KYsXZYnPXh8oxU5qJgdDNy7-pQIi1070gCLcBGAsYHQ/s1133/sharepoint%2Bonline%2Bdocument%2Blibrary%2Brequired%2Bfield.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online document library required field&quot; border=&quot;0&quot; data-original-height=&quot;802&quot; data-original-width=&quot;1133&quot; src=&quot;https://1.bp.blogspot.com/-oJC51mRZl1w/Xxc_wJXWzKI/AAAAAAAATFM/KYsXZYnPXh8oxU5qJgdDNy7-pQIi1070gCLcBGAsYHQ/d/sharepoint%2Bonline%2Bdocument%2Blibrary%2Brequired%2Bfield.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;You can also change required field configuration from list or library settings:&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Navigate to the list or library where you would like to mark a field as required.&lt;/li&gt;&lt;li&gt;Click on the settings gear icon in the top right of the page and select list settings. &lt;/li&gt;&lt;li&gt;In the List Settings page, Scroll down to the Columns section and Click on a Column that you would like to make required.&lt;/li&gt;&lt;li&gt;Scroll down to the Additional Column Settings and to select &quot;Yes&quot; to make the field required or &quot;No&quot; to make it optional.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-LoGLV0oGaqc/XxdAqHMfltI/AAAAAAAATFU/vkuIsoIwxOE8R7GguQWgy6WIDp-HkrYJACLcBGAsYHQ/s1036/sharepoint%2Bonline%2Brequired%2Bfield.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online required field&quot; border=&quot;0&quot; data-original-height=&quot;759&quot; data-original-width=&quot;1036&quot; src=&quot;https://1.bp.blogspot.com/-LoGLV0oGaqc/XxdAqHMfltI/AAAAAAAATFU/vkuIsoIwxOE8R7GguQWgy6WIDp-HkrYJACLcBGAsYHQ/d/sharepoint%2Bonline%2Brequired%2Bfield.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Select OK to save your changes.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;When users tries to saved a item or file without filling in the  required field, they&#39;ll see an error message &quot;You can&#39;t leave this  blank&quot;.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-UA_FI2JH1fk/Xxc7hELz0nI/AAAAAAAATE0/T2rKs9B1su0B_BWwH3bazAs9YgUSLyO1ACLcBGAsYHQ/s1200/make%2Ba%2Bfield%2Brequired%2Bin%2Bsharepoint%2Bonline.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;make a field required in sharepoint online&quot; border=&quot;0&quot; data-original-height=&quot;789&quot; data-original-width=&quot;1200&quot; src=&quot;https://1.bp.blogspot.com/-UA_FI2JH1fk/Xxc7hELz0nI/AAAAAAAATE0/T2rKs9B1su0B_BWwH3bazAs9YgUSLyO1ACLcBGAsYHQ/d/make%2Ba%2Bfield%2Brequired%2Bin%2Bsharepoint%2Bonline.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;If the default value is set for any field, such as Choice fields - Required field validation won&#39;t trigger as the default value will automatically apply. When you mark a field as required in SharePoint Online document libraries, and bulk upload files either by Drag-and-drop/Explorer view/Menu, The documents will be checked out automatically and not available for other users, until you populate the required fields and check-in documents.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, In modern libraries, this behavior is bit different: Documents will not be checked-out  (as long as the &quot;Require Check Out&quot; in the Versioning settings is set to &quot;No&quot;) when a mandatory field value is missing, but you&#39;ll see a message &quot;Required Info&quot; on those items.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-5BjTgCoS9ro/Xxc9b0AKgLI/AAAAAAAATFA/sRckm-KXUY0-_rSPVE_DN9ZCaoO50-DcACLcBGAsYHQ/s1150/document%2Blibrary%2Brequired%2Bfield%2Bin%2Bsharepoint%2Bonline.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;document library required field in sharepoint online&quot; border=&quot;0&quot; data-original-height=&quot;690&quot; data-original-width=&quot;1150&quot; src=&quot;https://1.bp.blogspot.com/-5BjTgCoS9ro/Xxc9b0AKgLI/AAAAAAAATFA/sRckm-KXUY0-_rSPVE_DN9ZCaoO50-DcACLcBGAsYHQ/d/document%2Blibrary%2Brequired%2Bfield%2Bin%2Bsharepoint%2Bonline.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;PowerShell to Change Required Fields Settings in SharePoint Online:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;We can turn required field settings for all fields in a SharePoint List or library to either ON or OFF using PowerShell as:&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Set Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/PMO&quot;&lt;br /&gt;$ListName = &quot;Projects&quot;&lt;br /&gt;&lt;br /&gt;#Connect to SharePoint Online&lt;br /&gt;Connect-PnPOnline -Url $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;#Get the List&lt;br /&gt;$List = Get-PnPList -Identity $ListName&lt;br /&gt;&lt;br /&gt;#Get all Required Fields - Exclude system fields&lt;br /&gt;$RequiredFields = Get-PnPField -List $List | Where { $_.Required -eq $true -and $_.Title -ne &quot;Name&quot; -and $_.ReadOnlyField -eq $false -and $_.Hidden -eq $false -and $_.InternalName -ne  &quot;ContentType&quot; -and $_.InternalName -ne  &quot;Attachments&quot;}&lt;br /&gt;&lt;br /&gt;ForEach($Field in $RequiredFields)&lt;br /&gt;{&lt;br /&gt;    #Set Required Field Flag to False&lt;br /&gt;    $Field.Required = $False&lt;br /&gt;    $Field.Update()&lt;br /&gt;    Invoke-PnPQuery&lt;br /&gt;    Write-Host &quot;Required Field Settings updated for $($Field.Title)&quot;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;This script removes require field flag from all columns. You can set the flag as $True and change the where condition to do the reverse as well. Here is my another post on setting a field as required or not-required using PowerShell: &lt;a href=&quot;https://www.sharepointdiary.com/2018/01/make-field-required-in-sharepoint-online-using-powershell.html&quot;&gt; How to Make a Field Required in SharePoint Online using PowerShell?&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/216870942048828587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/change-required-field-settings-in-sharepoint-online-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/216870942048828587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/216870942048828587'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/change-required-field-settings-in-sharepoint-online-list.html' title='SharePoint Online: How to Change Required Field Settings in a List or Library?'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-3955807084811089438</id><published>2020-01-27T00:33:00.000+05:30</published><updated>2020-07-24T13:47:51.669+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSV"/><category scheme="http://www.blogger.com/atom/ns#" term="Document Library"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>SharePoint Online: Bulk Update Metadata Properties from a CSV File using PowerShell</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Bulk Update Metadata of Multiple Documents from a CSV in SharePoint Online.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;b&gt;SharePoint Online: &lt;/b&gt;PowerShell to Bulk Edit Metadata Properties from a CSV File&lt;/b&gt;&lt;/div&gt;&lt;div&gt;We&#39;ve a document library with a 100s of documents in several sub-folders and wanted to bulk update metadata of all those documents. While quick edit is one option, its really cumbersome to navigate through each folder and update properties of each document.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The solution we arrived is to prepare a CSV file with list of files to update and populate the CSV with required metadata and use PowerShell script to bulk edit metadata of all documents from the CSV file.&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;PowerShell to Get All Files from a Document Library to CSV&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Let&#39;s generate document inventory from all folders and sub-folders of a given SharePoint Online document library:&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/marketing&quot;&lt;br /&gt;$ListName= &quot;Branding&quot;&lt;br /&gt;$CSVOutput = &quot;C:\Temp\DocInventory.csv&quot;&lt;br /&gt;&lt;br /&gt;#Connect to SharePoint Online site&lt;br /&gt;Connect-PnPOnline $SiteURL -UseWebLogin&lt;br /&gt; &lt;br /&gt;#Get all Files from the document library&lt;br /&gt;$ListItems = Get-PnPListItem -List $ListName -PageSize 2000 -Fields &quot;FileLeafRef&quot; | Where {$_.FileSystemObjectType -eq &quot;File&quot;}&lt;br /&gt;&lt;br /&gt;#Iterate through each item&lt;br /&gt;$DocumentsList = @()&lt;br /&gt;Foreach ($Item in $ListItems) &lt;br /&gt;{&lt;br /&gt;    #Extract File Name and URL&lt;br /&gt;    $DocumentsList += New-Object PSObject -Property ([ordered]@{&lt;br /&gt;        FileName          = $Item.FieldValues.FileLeafRef&lt;br /&gt;        ServerRelativeURL = $Item.FieldValues.FileRef&lt;br /&gt;    })&lt;br /&gt;}&lt;br /&gt;#Export the results&lt;br /&gt;$DocumentsList | Export-Csv -Path $CSVOutput -NoTypeInformation&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;This script generates a CSV file with &quot;FileName&quot; and &quot;ServerRelativeURL&quot; columns of all files from a given document library.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;PowerShell to Bulk Update Metadata in SharePoint Online&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Once we have the files list ready, populated the file with relevant metadata and used this script to update. This script uses &quot;ServerRelativePath&quot; as the key to get files and update. Here is my CSV file:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-Q_noFRTH42A/XxqSkBlXJPI/AAAAAAAATHY/bWKSOlRULRwhI6Az4BwwE5U9r8JHb0hAwCLcBGAsYHQ/s1106/bulk%2Bupdate%2Bdocument%2Bproperties%2Busing%2Bpowershell.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;bulk update document properties using powershell&quot; border=&quot;0&quot; data-original-height=&quot;425&quot; data-original-width=&quot;1106&quot; src=&quot;https://1.bp.blogspot.com/-Q_noFRTH42A/XxqSkBlXJPI/AAAAAAAATHY/bWKSOlRULRwhI6Az4BwwE5U9r8JHb0hAwCLcBGAsYHQ/d/bulk%2Bupdate%2Bdocument%2Bproperties%2Busing%2Bpowershell.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;You can download the CSV from &lt;a href=&quot;https://sites.google.com/site/salaudeenar/DocMetadata.csv?attredirects=0&amp;amp;d=1&quot;&gt;CSV to Bulk Update metadata in SharePoint Online&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/marketing&quot;&lt;br /&gt;$ListName= &quot;Branding&quot;&lt;br /&gt;$CSVFile = &quot;C:\Temp\DocMetadata.csv&quot;&lt;br /&gt;&lt;br /&gt;#Function to get Lookup ID from Lookup Value&lt;br /&gt;Function Get-LookupID($ListName, $LookupFieldName, $LookupValue)&lt;br /&gt;{&lt;br /&gt;    #Get Parent Lookup List and Field from Child Lookup Field&#39;s Schema XML&lt;br /&gt;    $LookupField =  Get-PnPField -List $ListName -Identity $LookupFieldName&lt;br /&gt;    [Xml]$Schema = $LookupField.SchemaXml&lt;br /&gt;    $ParentListID = $Schema.Field.Attributes[&quot;List&quot;].&#39;#text&#39;&lt;br /&gt;    $ParentField  = $Schema.field.Attributes[&quot;ShowField&quot;].&#39;#text&#39;&lt;br /&gt;    $ParentLookupItem  = Get-PnPListItem -List $ParentListID -Fields $ParentField | Where {$_[$ParentField] -eq $LookupValue} | Select -First 1 &lt;br /&gt;    If($ParentLookupItem -ne $Null)  { Return $ParentLookupItem[&quot;ID&quot;] }  Else  { Return $Null }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Try {&lt;br /&gt;    #Connect to SharePoint Online site&lt;br /&gt;    Connect-PnPOnline $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;    #Get the data from CSV file&lt;br /&gt;    $CSVData = Import-CSV $CSVFile&lt;br /&gt;&lt;br /&gt;    #Get fields to Update from the List - Skip Read-only, hidden fields and content type&lt;br /&gt;    $ListFields = Get-PnPField -List $ListName | Where { (-Not ($_.ReadOnlyField)) -and (-Not ($_.Hidden)) -and ($_.InternalName -ne  &quot;ContentType&quot;) }&lt;br /&gt;&lt;br /&gt;    #Loop through each Row in the CSV file and update metadata&lt;br /&gt;    ForEach($Row in $CSVData)&lt;br /&gt;    {&lt;br /&gt;        #Get All columns from CSV - Exclude &quot;FileName&quot; and &quot;ServerRelativeURL&quot; Columns&lt;br /&gt;        $CSVFields = $Row | Get-Member -MemberType NoteProperty | Select -ExpandProperty Name | Where {$_.Name -notin (&quot;FileName&quot;,&quot;ServerRelativeURL&quot;)}&lt;br /&gt;&lt;br /&gt;        #Get the File to update&lt;br /&gt;        $File = Get-PnPFile -Url $Row.ServerRelativeURL -AsListItem -ErrorAction SilentlyContinue&lt;br /&gt;        If($File -ne $Null)&lt;br /&gt;        {&lt;br /&gt;            #Frame the Metadata to update&lt;br /&gt;            $ItemValue = @{}&lt;br /&gt;&lt;br /&gt;            #Map each field from CSV to target list&lt;br /&gt;            Foreach($CSVField in $CSVFields)&lt;br /&gt;            {&lt;br /&gt;                $MappedField = $ListFields | Where {$_.InternalName -eq $CSVField}&lt;br /&gt;                If($MappedField -ne $Null)&lt;br /&gt;                {&lt;br /&gt;                    $FieldName = $MappedField.InternalName&lt;br /&gt;                    #Check if the Field value is not Null&lt;br /&gt;                    If($Row.$CSVField -ne $Null)&lt;br /&gt;                    {&lt;br /&gt;                        #Handle Special Fields&lt;br /&gt;                        $FieldType  = $MappedField.TypeAsString &lt;br /&gt;                        If($FieldType -eq &quot;User&quot; -or $FieldType -eq &quot;UserMulti&quot;) #People Picker Field&lt;br /&gt;                        {&lt;br /&gt;                            $PeoplePickerValues = $Row.$FieldName.Split(&quot;,&quot;)&lt;br /&gt;                            $ItemValue.add($FieldName,$PeoplePickerValues)&lt;br /&gt;                        }&lt;br /&gt;                        ElseIf($FieldType -eq &quot;Lookup&quot; -or $FieldType -eq &quot;LookupMulti&quot;) #Lookup Field&lt;br /&gt;                        {&lt;br /&gt;                            $LookupIDs = $Row.$FieldName.Split(&quot;,&quot;) | ForEach-Object { Get-LookupID -ListName $ListName -LookupFieldName $FieldName -LookupValue $_ }                &lt;br /&gt;                            $ItemValue.Add($FieldName,$LookupIDs)&lt;br /&gt;                        }&lt;br /&gt;                        Else&lt;br /&gt;                        {&lt;br /&gt;                            #Get Source Field Value and add to Hashtable&lt;br /&gt;                            $ItemValue.Add($FieldName,$Row.$FieldName)&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            #Update document properties&lt;br /&gt;            Write-host &quot;Updating Metadata of the File &#39;$($Row.FileName)&#39; at &#39;$($Row.ServerRelativeURL)&#39; with values:&quot;&lt;br /&gt;            $ItemValue | Format-Table&lt;br /&gt;            Set-PnPListItem -List $ListName -Identity $File.Id -Values $ItemValue | Out-Null&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-Host &quot;Could not find File at $($Row.ServerRelativeURL)&#39; , Skipped!&quot; -f Yellow&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;Catch {&lt;br /&gt;    write-host &quot;Error: $($_.Exception.Message)&quot; -foregroundcolor Red&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Make sure your CSV column headers are matching the internal names (not the display names!) of the metadata columns in your document library. Also, verify the format of the metadata entered in your CSV file once. (E.g. If you supply invalid metadata, then the update would not take place - Obviously!) E.g. For MMS fields, the format should be: TermGroup|TermSet|Term.</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/3955807084811089438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/07/powershell-to-bulk-update-metadata-from-csv-in-sharepoint-online.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/3955807084811089438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/3955807084811089438'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/07/powershell-to-bulk-update-metadata-from-csv-in-sharepoint-online.html' title='SharePoint Online: Bulk Update Metadata Properties from a CSV File using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-6629216342417157735</id><published>2020-01-26T18:29:00.001+05:30</published><updated>2020-06-22T00:44:38.214+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Client Side Object Model (CSOM)"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Admin Center"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><category scheme="http://www.blogger.com/atom/ns#" term="User Profile"/><title type='text'>SharePoint Online: PowerShell to Get All User Profiles</title><content type='html'>&lt;b&gt;Requirement: &lt;/b&gt;Get All User Profiles in SharePoint Online using PowerShell.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to Get User Profiles in SharePoint Online?&lt;/b&gt;&lt;br /&gt;User Profiles in SharePoint is a central location that stores information about users. It enables My Sites, social features and share profiles across multiple sites in the tenant. To get all user profiles&amp;nbsp; in SharePoint Online:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Login to SharePoint Online Admin &amp;gt;&amp;gt; Click on &quot;More Features&quot; in left navigation &amp;gt;&amp;gt; Click on &quot;Open&quot; button next to &quot;User Profiles&quot;.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-0ySTLwGtsdY/XjgK-7kkiKI/AAAAAAAARJQ/j6NwuMwHRxg7JCe0YU9if1zFPDq5JYizgCLcBGAsYHQ/s1600/powershell%2Bto%2Bget%2Ball%2Buser%2Bprofiles%2Bin%2Bsharepoint%2Bonline.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;powershell to get all user profiles in sharepoint online&quot; border=&quot;0&quot; data-original-height=&quot;682&quot; data-original-width=&quot;1067&quot; src=&quot;https://1.bp.blogspot.com/-0ySTLwGtsdY/XjgK-7kkiKI/AAAAAAAARJQ/j6NwuMwHRxg7JCe0YU9if1zFPDq5JYizgCLcBGAsYHQ/s1600/powershell%2Bto%2Bget%2Ball%2Buser%2Bprofiles%2Bin%2Bsharepoint%2Bonline.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;In User Profiles page, Click on &quot;Manage User Profiles&quot; under People tab. Use Search to get the user profile of the user.&lt;a href=&quot;https://3.bp.blogspot.com/-kai26DtHpeg/Wmh4zHExnNI/AAAAAAAAN-M/aq4ObVnC5lYFH_XZ-Wrg8BDiWuAdBiGlACLcBGAs/s1600/SharePoint%2Bonline%2Bget%2Ball%2Buser%2Bprofiles%2Bpowershell.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img alt=&quot;SharePoint online get all user profiles powershell&quot; border=&quot;0&quot; data-original-height=&quot;476&quot; data-original-width=&quot;875&quot; src=&quot;https://3.bp.blogspot.com/-kai26DtHpeg/Wmh4zHExnNI/AAAAAAAAN-M/aq4ObVnC5lYFH_XZ-Wrg8BDiWuAdBiGlACLcBGAs/s1600/SharePoint%2Bonline%2Bget%2Ball%2Buser%2Bprofiles%2Bpowershell.png&quot; /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;This page helps us to get individual user profiles and properties one by one. Now, Let&#39;s see how to get all user profiles in SharePoint Online using PowerShell.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SharePoint Online: PowerShell to Get All User Profiles&lt;/b&gt;&lt;br /&gt;Let&#39;s get all user profiles in SharePoint Online using PowerShell &lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Load SharePoint CSOM Assemblies&lt;br /&gt;Add-Type -Path &quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll&quot;&lt;br /&gt;Add-Type -Path &quot;C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll&quot;&lt;br /&gt;Add-Type -Path &quot;C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.UserProfiles.dll&quot;&lt;br /&gt; &lt;br /&gt;#Variables&lt;br /&gt;$AdminSiteUrl = &quot;https://crescent-admin.sharepoint.com&quot;&lt;br /&gt;$CSVPath = &quot;C:\Temp\UserProfiles.csv&quot;&lt;br /&gt;&lt;br /&gt;#Get Credentials&lt;br /&gt;$Cred = Get-Credential&lt;br /&gt;&lt;br /&gt;#Connect to AzureAD&lt;br /&gt;Connect-AzureAD -Credential $Cred&lt;br /&gt;&lt;br /&gt;#Get All Users from AzureAD&lt;br /&gt;$AllUsers = Get-AzureADUser -All:$True&lt;br /&gt;Write-host &quot;Total Number of User Profiles Found:&quot;$AllUsers.Count&lt;br /&gt;&lt;br /&gt;#Setup the context&lt;br /&gt;$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)&lt;br /&gt;$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($AdminSiteURL)&lt;br /&gt;$Ctx.Credentials = $Credentials&lt;br /&gt;&lt;br /&gt;#Collect User data&lt;br /&gt;$PeopleManager = New-Object Microsoft.SharePoint.Client.UserProfiles.PeopleManager($Ctx)&lt;br /&gt;$UserDataCollection = @()&lt;br /&gt;&lt;br /&gt;$Counter = 1&lt;br /&gt;ForEach($User in $AllUsers)&lt;br /&gt;{&lt;br /&gt;    #Get User Profile&lt;br /&gt;    $UserProfile = $PeopleManager.GetPropertiesFor((&#39;i:0#.f|membership|&#39;+$User.UserPrincipalName))&lt;br /&gt;    $Ctx.Load($UserProfile)&lt;br /&gt;    $Ctx.ExecuteQuery()&lt;br /&gt;&lt;br /&gt;    Write-Progress -Activity &quot;Extracting User Profile Data...&quot; -Status &quot;Getting User Profile $Counter of $($AllUsers.Count)&quot; -PercentComplete (($Counter / $AllUsers.Count)  * 100)&lt;br /&gt;    #Get User Profile Data&lt;br /&gt;    $UserData = New-Object PSObject&lt;br /&gt;    ForEach($Key in $UserProfile.UserProfileProperties.Keys)&lt;br /&gt;    {   &lt;br /&gt;        $UserData | Add-Member NoteProperty $Key($UserProfile.UserProfileProperties[$Key])&lt;br /&gt;    }&lt;br /&gt;    $UserDataCollection += $UserData&lt;br /&gt;    $Counter++&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Export Data to CSV File&lt;br /&gt;$UserDataCollection | Export-Csv -Path $CSVPath -NoTypeInformation&lt;/pre&gt;&lt;br /&gt;This PowerShell gets all user profiles and properties in SharePoint Online.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-WyujHeS2zq0/Xi2MlqGuL9I/AAAAAAAARIE/RnagkRRekw0-1YBMF1a-V9Bpe_0AZHd_gCLcBGAsYHQ/s1600/sharepoint%2Bonline%2Bget%2Ball%2Buser%2Bprofiles%2Bpowershell.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online get all user profiles powershell&quot; border=&quot;0&quot; data-original-height=&quot;752&quot; data-original-width=&quot;1600&quot; src=&quot;https://1.bp.blogspot.com/-WyujHeS2zq0/Xi2MlqGuL9I/AAAAAAAARIE/RnagkRRekw0-1YBMF1a-V9Bpe_0AZHd_gCLcBGAsYHQ/s1600/sharepoint%2Bonline%2Bget%2Ball%2Buser%2Bprofiles%2Bpowershell.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;Here is my other post to get all user profile properties: &lt;a href=&quot;https://www.sharepointdiary.com/2017/01/sharepoint-online-get-user-profile-properties-using-powershell.html&quot;&gt;SharePoint Online: PowerShell to Get User Profile Properties&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/6629216342417157735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-powershell-to-get-all-user-profiles.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/6629216342417157735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/6629216342417157735'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-powershell-to-get-all-user-profiles.html' title='SharePoint Online: PowerShell to Get All User Profiles'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-0ySTLwGtsdY/XjgK-7kkiKI/AAAAAAAARJQ/j6NwuMwHRxg7JCe0YU9if1zFPDq5JYizgCLcBGAsYHQ/s72-c/powershell%2Bto%2Bget%2Ball%2Buser%2Bprofiles%2Bin%2Bsharepoint%2Bonline.png" height="72" width="72"/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-5350378222164366683</id><published>2020-01-26T01:21:00.010+05:30</published><updated>2020-07-06T14:40:47.838+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Alerts"/><category scheme="http://www.blogger.com/atom/ns#" term="External Sharing"/><category scheme="http://www.blogger.com/atom/ns#" term="OneDrive for Business"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>SharePoint Online: Monitor External Sharing Invitations with Alerts</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement:&lt;/b&gt; Monitor SharePoint Online and OneDrive external sharing invitations.&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;SharePoint Online: Configure External Sharing Alert&lt;/b&gt;&lt;/div&gt;&lt;div&gt;When external sharing is enabled, users share files stored in SharePoint or OneDrive for Business site securely with team members, colleagues, external vendors or partners. You can audit the external user invitations in SharePoint Online and OneDrive for Business by using the &lt;b&gt;Set-SPOTenant &lt;/b&gt;cmdlet with &quot;BccExternalSharingInvitations&quot; parameter to &quot;$True&quot; and providing a list of email addresses to &quot;BccExternalSharingInvitationsList&quot;. By default, this configuration is set to False - meaning BCC for external sharing is disabled. You can turn it ON and configure E-mail address to receive notification when external sharing invitations are sent.&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$TenantAdminURL = &quot;https://crescent-admin.sharepoint.com&quot;&lt;br /&gt;&lt;br /&gt;#Connect to Admin Center&lt;br /&gt;Connect-SPOService -Url $TenantAdminURL -Credential (Get-Credential)&lt;br /&gt;&lt;br /&gt;#enable alert for external user invitation&lt;br /&gt;Set-SPOTenant -BccExternalSharingInvitations $True -BccExternalSharingInvitationsList &quot;Admin@Crescent.com&quot;&lt;br /&gt;&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-x5Eht7JN7uo/XsyTdRkG5bI/AAAAAAAASMQ/X3a3eh6bJM8l1OC8BvZdFcUJ62bRoPGOACK4BGAsYHg/BCC%2Bexternal%2Buser%2Binvitations%2Bin%2Bsharepoint%2Bonline%2Band%2BOnedrive.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;external user invitation monitor in sharepoint online and Onedrive&quot; border=&quot;0&quot; data-original-height=&quot;345&quot; data-original-width=&quot;942&quot; src=&quot;https://1.bp.blogspot.com/-x5Eht7JN7uo/XsyTdRkG5bI/AAAAAAAASMQ/X3a3eh6bJM8l1OC8BvZdFcUJ62bRoPGOACK4BGAsYHg/d/BCC%2Bexternal%2Buser%2Binvitations%2Bin%2Bsharepoint%2Bonline%2Band%2BOnedrive.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This will blind-copy (BCC) the e-mail messages to the E-mail IDs listed in the BccExternalSharingsInvitationList parameter. You can specify either a single email address or multiple addresses by creating a comma separated list with no spaces. &lt;/div&gt;&lt;div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;Set-SPOTenant -BccExternalSharingInvitations $True -BccExternalSharingInvitationsList &quot;Admin@Crescent.com,helpdesk@Crescent.com&quot;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;As a result, a copy of every external user invitation will be sent to the specified E-mails and remain available for later auditing or review. This can be a PowerShell way of Monitoring External Sharing Invitations if needed. &lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Disable BCC External Sharing Invitations&lt;/b&gt;&lt;br /&gt;To disable the BCC external sharing invitations, just set the flag to False.   &lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;Set-SPOTenant -BccExternalSharingInvitations $False&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Check Existing Settings using Get-SPOTenant cmdlet&lt;/b&gt;&lt;br /&gt;&lt;div&gt;You can check the existing setting for tenant using:&lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;Get-SPOTenant | Select BccExternalSharingInvitations, BccExternalSharingInvitationsList&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Monitor External User Sharing using Compliance Center Alerts&lt;/b&gt;&lt;/div&gt;&lt;div&gt;External sharing report is a common requirement in organizations. We can either search Audit logs and get a list of all of externally shared resources or create a alert policy to get E-mail notification as and when it happens. To monitor external content sharing using Microsoft 365 compliance center, &lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Navigate to compliance center alert policies at &lt;a href=&quot;https://protection.office.com/alertpolicies&quot; target=&quot;_blank&quot;&gt;https://protection.office.com/alertpolicies&lt;/a&gt; &lt;/li&gt;&lt;li&gt;Click on New alert policy &amp;gt;&amp;gt; Provide name and other parameters.&lt;/li&gt;&lt;li&gt;Choose the activity as &quot;Shared File Externally&quot; and create the policy.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;More information here: &lt;a href=&quot;https://docs.microsoft.com/en-us/microsoft-365/compliance/alert-policies?view=o365-worldwide&quot;&gt;https://docs.microsoft.com/en-us/microsoft-365/compliance/alert-policies?view=o365-worldwide&lt;/a&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/5350378222164366683/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/shareoint-online-external-sharing-alerts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/5350378222164366683'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/5350378222164366683'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/shareoint-online-external-sharing-alerts.html' title='SharePoint Online: Monitor External Sharing Invitations with Alerts'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-9004748727275118668</id><published>2020-01-22T15:14:00.001+05:30</published><updated>2020-07-22T18:48:59.906+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Errors"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>Fix &quot;The sign-in name or password does not match one in the Microsoft account system&quot; Error in SharePoint Online</title><content type='html'>&lt;div&gt;&lt;b&gt;Problem:&lt;/b&gt; Getting &quot;The sign-in name or password does not match one in the Microsoft account system&quot; Error in SharePoint Online.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-CzdO6k2bh0w/XxgOr70LRMI/AAAAAAAATFk/KRDG_IiMUmYdTYm95VhnOidgKE6UZhiIACLcBGAsYHQ/s931/The%2Bsign-in%2Bname%2Bor%2Bpassword%2Bdoes%2Bnot%2Bmatch%2Bone%2Bin%2Bthe%2Bmicrosoft%2Baccount%2Bsystem..png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;The sign-in name or password does not match one in the Microsoft account system.&quot; border=&quot;0&quot; data-original-height=&quot;186&quot; data-original-width=&quot;931&quot; src=&quot;https://1.bp.blogspot.com/-CzdO6k2bh0w/XxgOr70LRMI/AAAAAAAATFk/KRDG_IiMUmYdTYm95VhnOidgKE6UZhiIACLcBGAsYHQ/d/The%2Bsign-in%2Bname%2Bor%2Bpassword%2Bdoes%2Bnot%2Bmatch%2Bone%2Bin%2Bthe%2Bmicrosoft%2Baccount%2Bsystem..png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Solution:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;I&#39;ve experienced this error in SharePoint Online PowerShell scripts couple of times and this could happen in any of the PowerShell methods like CSOM, SharePoint Online Management Shell, or PnP PowerShell. Here are the possible causes and solutions:&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Your user name or password could be wrong (Obviously!). Check if you are able to login using web browser with the user name and password given in the PowerShell script.&lt;/li&gt;&lt;li&gt;Your password may be expired or account may be locked out or disabled.&lt;/li&gt;&lt;li&gt;Your saved password in Windows credentials store could be incorrect or expired (especially when you use PnP PowerShell module Connect-PnPOnline to get credentials from Windows Credentials store)&lt;/li&gt;&lt;li&gt;Your account may be MFA (Multi-factor authentication) enabled! If yes, either MFA must be turned-OFF or you have to follow the methods described in : &lt;a href=&quot;https://www.sharepointdiary.com/2019/08/connect-sharepoint-online-powershell-using-mfa.html&quot;&gt;How to Connect to SharePoint Online with MFA enabled Accounts from PowerShell?&lt;/a&gt;&lt;/li&gt;&lt;li&gt;When you are working with multiple tenants, make sure the supplied credentials are matching the given URL. E.g. If you are trying to connect to https://crescent.sharepoint.com, make sure you are providing username@crescent.com (or whatever is appropriate!) but not &quot;username@someotherdomain.com&quot; in SharePoint Online.&lt;/li&gt;&lt;li&gt;&amp;nbsp;Instead of using User name and password you can use App ID &amp;amp; Password: &lt;a href=&quot;https://www.sharepointdiary.com/2019/03/connect-pnponline-with-appid-and-appsecret.html&quot;&gt;How to Connect to SharePoint Online using AppID and AppSecret in PnP PowerShell?&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/9004748727275118668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/07/fix-sign-in-name-password-does-not-match-one-in-microsoft-account-system-error.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/9004748727275118668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/9004748727275118668'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/07/fix-sign-in-name-password-does-not-match-one-in-microsoft-account-system-error.html' title='Fix &quot;The sign-in name or password does not match one in the Microsoft account system&quot; Error in SharePoint Online'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-1874625338001559037</id><published>2020-01-16T13:27:00.006+05:30</published><updated>2020-07-09T10:14:37.196+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Features"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><category scheme="http://www.blogger.com/atom/ns#" term="Site Collection"/><category scheme="http://www.blogger.com/atom/ns#" term="Subsite"/><category scheme="http://www.blogger.com/atom/ns#" term="Tenant"/><title type='text'>SharePoint Online: Activate a Feature on All Sites using PowerShell</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Enable a SharePoint Online feature for all sites using PowerShell.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-GpGHNdpgCOI/XwXqoU4ld7I/AAAAAAAAS-o/gVlcw4qHeqcJuJk40O6UU8xiNdpdJLrOgCK4BGAsYHg/s1042/powershell%2Bto%2Bactivate%2Bfeature%2Bon%2Ball%2Bsites%2Bin%2Bsharepoint%2Bonline.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online powershell enable feature on all site collections&quot; border=&quot;0&quot; data-original-height=&quot;780&quot; data-original-width=&quot;1042&quot; src=&quot;https://1.bp.blogspot.com/-GpGHNdpgCOI/XwXqoU4ld7I/AAAAAAAAS-o/gVlcw4qHeqcJuJk40O6UU8xiNdpdJLrOgCK4BGAsYHg/d/powershell%2Bto%2Bactivate%2Bfeature%2Bon%2Ball%2Bsites%2Bin%2Bsharepoint%2Bonline.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;PowerShell to Activate a Site Collection Feature for All Sites&lt;/b&gt;&lt;/div&gt;&lt;div&gt;We have a requirement to enable a SharePoint Online &quot;Open Documents in Client Applications by Default&quot; feature for all site collections in the tenant. Here is the PowerShell to enable a feature for all site collections.&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$TenantAdminURL = &quot;https://Crescent-Admin.SharePoint.com&quot;&lt;br /&gt;#Site Collection feature &quot;Open Documents in Client Applications by Default&quot;&lt;br /&gt;$FeatureId = &quot;8a4b8de2-6fd8-41e9-923c-c7c3c00f8295&quot; &lt;br /&gt;&lt;br /&gt;#Connect to Admin Center&lt;br /&gt;$Cred = Get-Credential&lt;br /&gt;Connect-PnPOnline -Url $TenantAdminURL -Credentials $Cred&lt;br /&gt;&lt;br /&gt;#Get All Site collections - Exclude: Seach Center, Mysite Host, App Catalog, Content Type Hub, eDiscovery and Bot Sites&lt;br /&gt;$SitesCollections = Get-PnPTenantSite | Where -Property Template -NotIn (&quot;SRCHCEN#0&quot;, &quot;SPSMSITEHOST#0&quot;, &quot;APPCATALOG#0&quot;, &quot;POINTPUBLISHINGHUB#0&quot;, &quot;EDISC#0&quot;, &quot;STS#-1&quot;)&lt;br /&gt;&lt;br /&gt;#Loop through each site collection&lt;br /&gt;ForEach($Site in $SitesCollections)&lt;br /&gt;{&lt;br /&gt;    #Connect to site collection&lt;br /&gt;    Write-host -f Yellow &quot;Trying to Activate the feature on site:&quot;$Site.Url    &lt;br /&gt;    $SiteConn = Connect-PnPOnline -Url $Site.Url -Credentials $Cred&lt;br /&gt;&lt;br /&gt;    #Get the Feature&lt;br /&gt;    $Feature = Get-PnPFeature -Scope Site -Identity $FeatureId -Connection $SiteConn&lt;br /&gt;&lt;br /&gt;    #Check if feature is activated&lt;br /&gt;    If($Feature.DefinitionId -eq $null)&lt;br /&gt;    {&lt;br /&gt;        #Enable site collection feature&lt;br /&gt;        Enable-PnPFeature -Scope Site -Identity $FeatureId -Force -Connection $SiteConn&lt;br /&gt;&lt;br /&gt;        Write-host -f Green &quot;`tFeature Activated Successfully!&quot;&lt;br /&gt;    }&lt;br /&gt;    Else&lt;br /&gt;    {&lt;br /&gt;        Write-host -f Cyan &quot;`tFeature is already active!&quot;&lt;br /&gt;    }&lt;br /&gt;    Disconnect-PnPOnline -Connection $SiteConn&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Enable a Site Feature in All Sites of a SharePoint Online Site Collection using &lt;/b&gt;&lt;b&gt;PowerShell &lt;/b&gt; &lt;/div&gt;&lt;div&gt;What if you want to activate a web scoped feature on all sites, including root site and subsites of a given site collection? Say, we want to activate &quot;Publishing &quot; feature on all sites (webs) in a SharePoint Online site collection. &lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/marketing&quot;&lt;br /&gt;$FeatureId = &quot;94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb&quot; #Web Scoped Publishing Feature&lt;br /&gt;&lt;br /&gt;#Function to Activate a Feature in SharePoint Online Web&lt;br /&gt;Function Activate-PnPWebFeature&lt;br /&gt;{ &lt;br /&gt;    [cmdletbinding()]&lt;br /&gt;    Param(&lt;br /&gt;        [parameter(Mandatory = $true, ValueFromPipeline = $True)] $Web,&lt;br /&gt;        [parameter(Mandatory = $true, ValueFromPipeline = $False)] $FeatureId&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    Try {&lt;br /&gt;        Write-host -f Yellow &quot;Trying to Activate Feature on:&quot;$web.Url&lt;br /&gt;        #Get the Feature to activate&lt;br /&gt;        $Feature = Get-PnPFeature -Scope Web -Identity $FeatureId -Web $Web -ErrorAction Stop&lt;br /&gt; &lt;br /&gt;        #Check if the Feature is Activate&lt;br /&gt;        If($Feature.DefinitionId -eq $null)&lt;br /&gt;        {    &lt;br /&gt;            #Activate feature            &lt;br /&gt;            Enable-PnPFeature -Scope Web -Identity $FeatureId -Force -Web $Web -Verbose -ErrorAction Stop&lt;br /&gt; &lt;br /&gt;            Write-host -f Green &quot;`tFeature Activated Successfully!&quot;&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-host -f Cyan &quot;`tFeature is already active!&quot;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        write-host &quot;`tError Activating Feature: $($_.Exception.Message)&quot; -foregroundcolor Red&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Connect to the site collection&lt;br /&gt;Connect-PnPOnline -Url $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;#Call the Function for Web &amp;amp; all Subwebs&lt;br /&gt;Get-PnPWeb | Activate-PnPWebFeature -FeatureId $FeatureId &lt;br /&gt;Get-PnPSubWebs -Recurse | ForEach-Object { Activate-PnPWebFeature $_ -FeatureId $FeatureId}&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;If your web scoped feature has any dependency on site collection  features, You must activate the site collection feature first! In our  case, We must activate publishing feature at the site collection prior  activating that feature in all webs.&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;PowerShell to Activate Feature On All Sites of the Tenant&lt;/b&gt;&lt;/div&gt;&lt;div&gt;How about activating a site feature for all sites in the tenant? The below PowerShell script enables given feature on all sites, including root site and its sub-sites of all site collections in the SharePoint Online tenant.&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$TenantAdminURL = &quot;https://Crescent-Admin.SharePoint.com&quot;&lt;br /&gt;$FeatureId = &quot;a7a2793e-67cd-4dc1-9fd0-43f61581207a&quot; #&quot;Following Content&quot; Web Scoped Feature&lt;br /&gt;&lt;br /&gt;#Function to Activate a Web Feature in SharePoint Online&lt;br /&gt;Function Activate-PnPWebFeature&lt;br /&gt;{ &lt;br /&gt;    [cmdletbinding()]&lt;br /&gt;    Param(&lt;br /&gt;        [parameter(Mandatory = $true, ValueFromPipeline = $True)] $Web,&lt;br /&gt;        [parameter(Mandatory = $true, ValueFromPipeline = $False)] $FeatureId&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    Try {&lt;br /&gt;        Write-host -f Yellow &quot;Trying to Activate Feature on:&quot;$web.Url&lt;br /&gt;        #Get the Feature to activate&lt;br /&gt;        $Feature = Get-PnPFeature -Scope Web -Identity $FeatureId -Web $Web -Connection $SiteConn -ErrorAction Stop&lt;br /&gt;&lt;br /&gt;        #Check if the Feature is Activate&lt;br /&gt;        If($Feature.DefinitionId -eq $null)&lt;br /&gt;        {&lt;br /&gt;            #Activate the feature&lt;br /&gt;            Enable-PnPFeature -Scope Web -Identity $FeatureId -Force -Web $Web -Connection $SiteConn -ErrorAction Stop &lt;br /&gt;            Write-host -f Green &quot;`tFeature Activated Successfully!&quot;&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-host -f Cyan &quot;`tFeature is already active!&quot;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        write-host &quot;`tError Activating Feature: $($_.Exception.Message)&quot; -foregroundcolor Red&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Connect to Admin Center&lt;br /&gt;$Cred = Get-Credential&lt;br /&gt;Connect-PnPOnline -Url $TenantAdminURL -Credentials $Cred&lt;br /&gt;&lt;br /&gt;#Get All Site collections - Exclude: Seach Center, Mysite Host, App Catalog, Content Type Hub, eDiscovery and Bot Sites&lt;br /&gt;$SitesCollections = Get-PnPTenantSite | Where -Property Template -NotIn (&quot;SRCHCEN#0&quot;, &quot;SPSMSITEHOST#0&quot;, &quot;APPCATALOG#0&quot;, &quot;POINTPUBLISHINGHUB#0&quot;, &quot;EDISC#0&quot;, &quot;STS#-1&quot;)&lt;br /&gt;&lt;br /&gt;#Loop through each site collection&lt;br /&gt;ForEach($Site in $SitesCollections)&lt;br /&gt;{&lt;br /&gt;    #Connect to site collection&lt;br /&gt;    $SiteConn = Connect-PnPOnline -Url $Site.Url -Credentials $Cred&lt;br /&gt;&lt;br /&gt;    #Call the Function for Web &amp;amp; all Subwebs&lt;br /&gt;    Get-PnPWeb -Connection $SiteConn | Activate-PnPWebFeature -FeatureId $FeatureId &lt;br /&gt;    Get-PnPSubWebs -Connection $SiteConn -Recurse | ForEach-Object { Activate-PnPWebFeature $_ -FeatureId $FeatureId}&lt;br /&gt;&lt;br /&gt;    Disconnect-PnPOnline -Connection $SiteConn   &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;To enable a feature in SharePoint Online site, use: &lt;a href=&quot;http://www.sharepointdiary.com/2015/01/sharepoint-online-activate-feature-using-powershell.html&quot; id=&quot;How to Enable a SharePoint Online feature using PowerShell?&quot; name=&quot;How to Enable a SharePoint Online feature using PowerShell?&quot;&gt;SharePoint Online: Activate a Feature using PowerShell&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;You can also enable a SharePoint Online feature in all site collections using PowerShell with SharePoint Online Management Shell and CSOM as in my another article: &lt;a href=&quot;https://www.sharepointdiary.com/2018/03/sharepoint-online-open-documents-in-client-applications.html&quot;&gt;PowerShell to enable a site collection feature for all sites in  SharePoint Online&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/1874625338001559037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-activate-feature-on-all-sites-using-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/1874625338001559037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/1874625338001559037'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-activate-feature-on-all-sites-using-powershell.html' title='SharePoint Online: Activate a Feature on All Sites using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-8625948697008961285</id><published>2020-01-10T23:03:00.009+05:30</published><updated>2020-07-09T10:13:16.997+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Features"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><category scheme="http://www.blogger.com/atom/ns#" term="Site Collection"/><category scheme="http://www.blogger.com/atom/ns#" term="Subsite"/><category scheme="http://www.blogger.com/atom/ns#" term="Tenant"/><title type='text'>SharePoint Online: Disable a Feature for All Sites using PowerShell</title><content type='html'>&lt;div&gt;&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Disable a feature for all SharePoint Online sites using PowerShell.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-x_w2ThjElCQ/XwXtEixr5gI/AAAAAAAAS_E/uKbwZXgf1SMMKdtmsESFEpP_0bE40qf0wCK4BGAsYHg/s1077/powershell%2Bto%2Bdisable%2Bfeature%2Bon%2Ball%2Bsites%2Bin%2Bsharepoint%2Bonline.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online deactivate feature on all sites using powershell&quot; border=&quot;0&quot; data-original-height=&quot;743&quot; data-original-width=&quot;1077&quot; src=&quot;https://1.bp.blogspot.com/-x_w2ThjElCQ/XwXtEixr5gI/AAAAAAAAS_E/uKbwZXgf1SMMKdtmsESFEpP_0bE40qf0wCK4BGAsYHg/d/powershell%2Bto%2Bdisable%2Bfeature%2Bon%2Ball%2Bsites%2Bin%2Bsharepoint%2Bonline.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;PowerShell to Deactivate a Site Feature on All &lt;/b&gt;&lt;b&gt;Collections in the Tenant &lt;/b&gt;&lt;/div&gt;&lt;div&gt;We  have a requirement to disable the SharePoint Online &quot;Open Documents in Client Applications by Default&quot; feature  for all  sites in the tenant. Here is the PowerShell to disable a feature for all site  collections.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$TenantAdminURL = &quot;https://crescent-Admin.sharepoint.com&quot;&lt;br /&gt;#Site Collection feature &quot;Open Documents in Client Applications by Default&quot;&lt;br /&gt;$FeatureId = &quot;8a4b8de2-6fd8-41e9-923c-c7c3c00f8295&quot; &lt;br /&gt;&lt;br /&gt;#Connect to Admin Center&lt;br /&gt;$Cred = Get-Credential&lt;br /&gt;Connect-PnPOnline -Url $TenantAdminURL -Credentials $Cred&lt;br /&gt;&lt;br /&gt;#Get All Site collections - Exclude: Seach Center, Mysite Host, App Catalog, Content Type Hub, eDiscovery and Bot Sites&lt;br /&gt;$SitesCollections = Get-PnPTenantSite | Where -Property Template -NotIn (&quot;SRCHCEN#0&quot;, &quot;SPSMSITEHOST#0&quot;, &quot;APPCATALOG#0&quot;, &quot;POINTPUBLISHINGHUB#0&quot;, &quot;EDISC#0&quot;, &quot;STS#-1&quot;)&lt;br /&gt;&lt;br /&gt;#Loop through each site collection&lt;br /&gt;ForEach($Site in $SitesCollections)&lt;br /&gt;{&lt;br /&gt;    #Connect to site collection&lt;br /&gt;    Write-host -f Yellow &quot;Trying to Deactivate the feature on site:&quot;$Site.Url    &lt;br /&gt;    $SiteConn = Connect-PnPOnline -Url $Site.Url -Credentials $Cred&lt;br /&gt;&lt;br /&gt;    #Get the Feature&lt;br /&gt;    $Feature = Get-PnPFeature -Scope Site -Identity $FeatureId -Connection $SiteConn&lt;br /&gt;&lt;br /&gt;    #Check if feature is activated&lt;br /&gt;    If($Feature.DefinitionId -ne $null)&lt;br /&gt;    {&lt;br /&gt;        #Disable site collection feature&lt;br /&gt;        Disable-PnPFeature -Scope Site -Identity $FeatureId -Force -Connection $SiteConn&lt;br /&gt;        Write-host -f Green &quot;`tFeature Deactivated Successfully!&quot;&lt;br /&gt;    }&lt;br /&gt;    Else&lt;br /&gt;    {&lt;br /&gt;        Write-host -f Cyan &quot;`tFeature is not active!&quot;&lt;br /&gt;    }&lt;br /&gt;    Disconnect-PnPOnline -Connection $SiteConn&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;How to Disable a Feature for All Sites in a Site Collection  using PowerShell?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Say, we want to disable &quot;Following Content&quot; site feature from all webs of a given site collection:&lt;br /&gt;&lt;b&gt; &lt;/b&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/marketing&quot;&lt;br /&gt;$FeatureId = &quot;a7a2793e-67cd-4dc1-9fd0-43f61581207a&quot; #&quot;Following Content&quot; Web Scoped Feature&lt;br /&gt;&lt;br /&gt;#Function to Deactivate a Feature in SharePoint Online Web&lt;br /&gt;Function Deactivate-PnPWebFeature&lt;br /&gt;{ &lt;br /&gt;    [cmdletbinding()]&lt;br /&gt;    Param(&lt;br /&gt;        [parameter(Mandatory = $true, ValueFromPipeline = $True)] $Web,&lt;br /&gt;        [parameter(Mandatory = $true, ValueFromPipeline = $False)] $FeatureId&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    Try {&lt;br /&gt;        Write-host -f Yellow &quot;Trying to Deactivate Feature on:&quot;$web.Url&lt;br /&gt;        #Get the Feature to Deactivate&lt;br /&gt;        $Feature = Get-PnPFeature -Scope Web -Identity $FeatureId -Web $Web -ErrorAction Stop&lt;br /&gt; &lt;br /&gt;        #Check if the Feature is Activate&lt;br /&gt;        If($Feature.DefinitionId -ne $null)&lt;br /&gt;        {    &lt;br /&gt;            #Deactivate feature            &lt;br /&gt;            Disable-PnPFeature -Scope Web -Identity $FeatureId -Force -Web $Web -Verbose -ErrorAction Stop&lt;br /&gt; &lt;br /&gt;            Write-host -f Green &quot;`tFeature Deactivated Successfully!&quot;&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-host -f Cyan &quot;`tFeature is not active!&quot;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        write-host &quot;`tError Activating Feature: $($_.Exception.Message)&quot; -foregroundcolor Red&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Connect to the site collection&lt;br /&gt;Connect-PnPOnline -Url $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;#Call the Function for Web &amp;amp; all Subwebs&lt;br /&gt;Get-PnPWeb | Deactivate-PnPWebFeature -FeatureId $FeatureId &lt;br /&gt;Get-PnPSubWebs -Recurse | ForEach-Object { Deactivate-PnPWebFeature $_ -FeatureId $FeatureId}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;SharePoint Online: Deactivate a feature on All Sites using PowerShell&lt;/b&gt;&lt;/div&gt;&lt;div&gt;We can deactivate a web scoped feature from all sites and subsites of the tenant with the below PowerShell.&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$TenantAdminURL = &quot;https://Crescent-Admin.sharepoint.com&quot;&lt;br /&gt;$FeatureId = &quot;a7a2793e-67cd-4dc1-9fd0-43f61581207a&quot; #&quot;Following Content&quot; Web Scoped Feature&lt;br /&gt;&lt;br /&gt;#Function to Deactivate a Web Feature in SharePoint Online&lt;br /&gt;Function Deactivate-PnPWebFeature&lt;br /&gt;{ &lt;br /&gt;    [cmdletbinding()]&lt;br /&gt;    Param(&lt;br /&gt;        [parameter(Mandatory = $true, ValueFromPipeline = $True)] $Web,&lt;br /&gt;        [parameter(Mandatory = $true, ValueFromPipeline = $False)] $FeatureId&lt;br /&gt;    )&lt;br /&gt;&lt;br /&gt;    Try {&lt;br /&gt;        Write-host -f Yellow &quot;Trying to Deactivate Feature on:&quot;$web.Url&lt;br /&gt;        #Get the Feature to Deactivate&lt;br /&gt;        $Feature = Get-PnPFeature -Scope Web -Identity $FeatureId -Web $Web -Connection $SiteConn -ErrorAction Stop&lt;br /&gt;&lt;br /&gt;        #Check if the Feature is activated&lt;br /&gt;        If($Feature.DefinitionId -ne $null)&lt;br /&gt;        {&lt;br /&gt;            #Deactivate the feature&lt;br /&gt;            Disable-PnPFeature -Scope Web -Identity $FeatureId -Force -Web $Web -Connection $SiteConn -ErrorAction Stop&lt;br /&gt;            Write-host -f Green &quot;`tFeature Deactivated Successfully!&quot;&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-host -f Cyan &quot;`tFeature is not active!&quot;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        write-host &quot;`tError Deactivating Feature: $($_.Exception.Message)&quot; -foregroundcolor Red&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Connect to Admin Center&lt;br /&gt;$Cred = Get-Credential&lt;br /&gt;Connect-PnPOnline -Url $TenantAdminURL -Credentials $Cred&lt;br /&gt;&lt;br /&gt;#Get All Site collections - Exclude: Seach Center, Mysite Host, App Catalog, Content Type Hub, eDiscovery and Bot Sites&lt;br /&gt;$SitesCollections = Get-PnPTenantSite | Where -Property Template -NotIn (&quot;SRCHCEN#0&quot;, &quot;SPSMSITEHOST#0&quot;, &quot;APPCATALOG#0&quot;, &quot;POINTPUBLISHINGHUB#0&quot;, &quot;EDISC#0&quot;, &quot;STS#-1&quot;)&lt;br /&gt;&lt;br /&gt;#Loop through each site collection&lt;br /&gt;ForEach($Site in $SitesCollections)&lt;br /&gt;{&lt;br /&gt;    #Connect to site collection&lt;br /&gt;    $SiteConn = Connect-PnPOnline -Url $Site.Url -Credentials $Cred&lt;br /&gt;&lt;br /&gt;    #Call the Function for Web and all Subwebs&lt;br /&gt;    Get-PnPWeb -Connection $SiteConn | Deactivate-PnPWebFeature -FeatureId $FeatureId &lt;br /&gt;    Get-PnPSubWebs -Connection $SiteConn -Recurse | ForEach-Object { Deactivate-PnPWebFeature $_ -FeatureId $FeatureId}&lt;br /&gt;&lt;br /&gt;    Disconnect-PnPOnline -Connection $SiteConn   &lt;br /&gt;}&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/8625948697008961285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-deactivate-feature-on-all-sites-using-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/8625948697008961285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/8625948697008961285'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-deactivate-feature-on-all-sites-using-powershell.html' title='SharePoint Online: Disable a Feature for All Sites using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-6173289874228210757</id><published>2020-01-07T14:16:00.001+05:30</published><updated>2020-07-21T16:06:23.472+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Office 365"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><category scheme="http://www.blogger.com/atom/ns#" term="User Profile"/><title type='text'>Office 365: How to Disable Delve in SharePoint Online?</title><content type='html'>&lt;b&gt;Requirement:&lt;/b&gt;&amp;nbsp; Disable Delve in SharePoint Online.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to Disable Delve for All Users in Office 365?&lt;/b&gt;&lt;br /&gt;Delve is an Office 365 App which is used to view and organize all related documents in one location. Microsoft Delve uses artificial intelligence and machine learning to display relevant information to you based on what you work on and who you work with from different applications within Microsoft 365, such as SharePoint, OneDrive, and Teams. Say for E.g. To find out what documents someone is working on, you can simply click on the person&#39;s name and see which documents they are working on. Although documents shown in Delve are security trimmed (Users will only see a document if they have access to it), some companies fear about their privacy and wants to disable delve for all users.&lt;br /&gt;&lt;br /&gt;To disable delve for all users in Office 365, follow these steps:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Login to your SharePoint Admin Center&lt;/li&gt;&lt;li&gt;Click on &quot;Settings&quot; from left navigation &amp;gt;&amp;gt; Click on &quot;classic settings page&quot; in the bottom&amp;gt;&amp;gt; Under Office graph, Select &quot;Don&#39;t allow access to the Office Graph&quot;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-m80NQXt6VjE/XEb7HJjuG2I/AAAAAAAAPSo/twfdOE0kMJQwc_at1a6foyi1N7Ps7HbVwCLcBGAs/s1600/disable%2Bdelve%2Bin%2Boffice%2B365.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;disable delve in office 365&quot; border=&quot;0&quot; data-original-height=&quot;124&quot; data-original-width=&quot;841&quot; src=&quot;https://3.bp.blogspot.com/-m80NQXt6VjE/XEb7HJjuG2I/AAAAAAAAPSo/twfdOE0kMJQwc_at1a6foyi1N7Ps7HbVwCLcBGAs/s1600/disable%2Bdelve%2Bin%2Boffice%2B365.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt; Click on &quot;OK&quot; button in the bottom of the page to commit your changes. &lt;/li&gt;&lt;/ul&gt;This disables delve in SharePoint Online for all users  for the entire tenant. (Please note, this does not disable Delve feature altogether, but it does not show any documents in Delve!)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to Disable the Delve User Profile Redirect?&lt;/b&gt;&lt;br /&gt;When you click on any user account in SharePoint Online, it takes you  to the Delve page of the user (or My Site in SharePoint On-premises). You can stop that redirect by appending &quot;Force=True&quot; parameter to the URL. https://yourdomain.sharepoint.com/_layouts/15/userdisp.aspx?ID=USERID&amp;amp;Force=True&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;E.g. https://yourdomain.sharepoint.com/_layouts/userdisp.aspx?ID=12&amp;amp;&lt;span style=&quot;background-color: #fff2cc;&quot;&gt;Force=True&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;This takes you to the simple user information page:&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-a9jZRBzJQEY/XEb72DPfRnI/AAAAAAAAPSw/-rL8O-_bZpcJ0rmiU6vw11aW8JU9DJGAQCLcBGAs/s1600/disable%2Bdelve%2Bfor%2Buser%2Bin%2Bsharepoint%2Bonline.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;disable delve for user in sharepoint online&quot; border=&quot;0&quot; data-original-height=&quot;656&quot; data-original-width=&quot;880&quot; src=&quot;https://3.bp.blogspot.com/-a9jZRBzJQEY/XEb72DPfRnI/AAAAAAAAPSw/-rL8O-_bZpcJ0rmiU6vw11aW8JU9DJGAQCLcBGAs/s1600/disable%2Bdelve%2Bfor%2Buser%2Bin%2Bsharepoint%2Bonline.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;Disable Delve  per User in SharePoint Online&lt;/b&gt;&lt;div&gt;We can also disable delve for one user! Users can individually opt out of sharing their documents with Delve and the Office Graph by login to Delve from the Waffle inside Office 365, or by going directly to the URL &lt;a href=&quot;https://delve.office.com&quot; id=&quot;https://delve.office.com&quot; name=&quot;https://delve.office.com&quot;&gt;https://delve.office.com&lt;/a&gt; and click on Settings gear &amp;gt;&amp;gt; Click on &quot;Feature settings&quot; and choose &quot;Off&quot; under documents. &lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-C2gO0qLauto/XxawnfMNeDI/AAAAAAAATEg/-SWEO4xBSMMD-WEhbuEzt3SZJqlp4G4rgCLcBGAsYHQ/s1264/disable%2Bdelve%2Bfor%2Bone%2Buser.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;disable delve for one user&quot; border=&quot;0&quot; data-original-height=&quot;765&quot; data-original-width=&quot;1264&quot; src=&quot;https://1.bp.blogspot.com/-C2gO0qLauto/XxawnfMNeDI/AAAAAAAATEg/-SWEO4xBSMMD-WEhbuEzt3SZJqlp4G4rgCLcBGAsYHQ/d/disable%2Bdelve%2Bfor%2Bone%2Buser.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;To disable delve for some users, just set below highlighted properties in their user profile to null.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://3.bp.blogspot.com/-4DCh6q5MLKY/XEcFKIjDFxI/AAAAAAAAPS8/5eVmli7tAdARZBIkULEGbairwxiehiqTwCLcBGAs/s1600/office%2B365%2Bdisable%2Bdelve%2Bper%2Buser.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;office 365 disable delve per user&quot; border=&quot;0&quot; data-original-height=&quot;395&quot; data-original-width=&quot;792&quot; src=&quot;https://3.bp.blogspot.com/-4DCh6q5MLKY/XEcFKIjDFxI/AAAAAAAAPS8/5eVmli7tAdARZBIkULEGbairwxiehiqTwCLcBGAs/s1600/office%2B365%2Bdisable%2Bdelve%2Bper%2Buser.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;You can also use PowerShell to set these user profile properties and disable delve for all users: Just set &quot;DelveFlags&quot; and &quot;OfficeGraphEnabled&quot; values to $null. &lt;a href=&quot;https://www.sharepointdiary.com/2017/01/sharepoint-online-update-user-profile-properties-using-powershell.html&quot; target=&quot;_blank&quot;&gt;How to Set User Profile Property in SharePoint Online using PowerShell?&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Setting &quot;msExchHideFromAddressLists&quot; attribute in AD and then it synched to SharePoint user profile property &quot;SPS-HideFromAddressLists&quot; - But it would hide the user from both Delve and Search results. &lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Disable Delve for Documents in SharePoint Online:&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Delve absolutely adheres to all permissions set in SharePoint and OneDrive for Business. No one will ever see anything they don’t already have access to. However, If you want to disable Delve for a particular document(s) in a site, you can create a site column called &quot;HideFromDelve&quot; of Boolean type (&quot;Yes/No&quot;) and add this column to each library and then set this flag to &quot;Yes&quot; for each document that you don&#39;t want to show in Delve. Here is the step by step instruction:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Step 1:&lt;/b&gt; Create &quot;HideFromDelve&quot; Site Column&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Navigate to the SharePoint Online site that has documents you want to hide them from Delve.&lt;/li&gt;&lt;li&gt;Click on settings gear in the top-right corner and go to Site Settings&lt;/li&gt;&lt;li&gt;In site settings page, Under Web Designer Galleries, click on &quot;Site columns&quot; &amp;gt;&amp;gt; Click on &quot;Create&quot;&lt;/li&gt;&lt;li&gt;Enter the column name as &quot;HideFromDelve&quot; (EXACT the same name), set column type as &quot;Yes/No&quot; Checkbox field.&lt;/li&gt;&lt;li&gt;Set the default value to &quot;No&quot; (Otherwise every document you create within the library will not show up in Delve!)&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;The next step is to add the site column libraries wherever required.&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Step 2:&lt;/b&gt; Add the &quot;HideFromDelve&quot; Site Column to document library&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Navigate to the library that has documents you want to hide &lt;br /&gt;&lt;/li&gt;&lt;li&gt;Go to Library Settings &amp;gt;&amp;gt;  Under the list of columns, click the link Add from existing site columns&lt;/li&gt;&lt;li&gt;Scrolls down in the Available site columns list and select the newly  created HideFromDelve column and click the add button to move it across.  Then click Ok.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;After the column is added to your library, the next step is to set that metadata for documents you want to hide from delve&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Step 3:&lt;/b&gt; Mark the Documents you want to hide from Delve&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Navigate back to your library and you can begin marking documents to  be hidden from Delve.&lt;/li&gt;&lt;li&gt;Edit document properties and set the &quot;HideFromDelve&quot; column value to &quot;Yes&quot;. The quickest way to do this is through the Quick  Edit view.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;After the documents have been re-indexed by the SharePoint search, they should no  longer be visible in Delve (but still searchable through SharePoint  search).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Disable delve in SharePoint Document Library or Site&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can also remove either a document library or site both from Delve  and SharePoint Online search results. Navigate to the document library &amp;gt;&amp;gt; Advanced  Settings, set &quot;Search&quot; to &quot;No&quot;. Similarly, In site settings &amp;gt;&amp;gt; Search &amp;gt;&amp;gt; Search and  Offline Availability &amp;gt;&amp;gt; Set &quot;Allow this site to appear in search results&quot;to &quot;No&quot;.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/6173289874228210757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/how-to-disable-delve-in-sharepoint-online.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/6173289874228210757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/6173289874228210757'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/how-to-disable-delve-in-sharepoint-online.html' title='Office 365: How to Disable Delve in SharePoint Online?'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://3.bp.blogspot.com/-m80NQXt6VjE/XEb7HJjuG2I/AAAAAAAAPSo/twfdOE0kMJQwc_at1a6foyi1N7Ps7HbVwCLcBGAs/s72-c/disable%2Bdelve%2Bin%2Boffice%2B365.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-4016287000670175046</id><published>2020-01-04T02:02:00.033+05:30</published><updated>2020-07-04T19:23:56.719+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSV"/><category scheme="http://www.blogger.com/atom/ns#" term="Folder"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'> SharePoint Online: Bulk Delete Folders from a CSV using PowerShell</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Bulk Delete Folders in SharePoint Online. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;How to Bulk Delete Multiple Folders in SharePoint Online?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;To bulk delete folders with its sub-folders and files, we can use a CSV file with PowerShell script.&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Set Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/Projects&quot;&lt;br /&gt;$CSVFilePath = &quot;C:\Users\Thomas\Desktop\BulkDeleteFolders.csv&quot;&lt;br /&gt;  &lt;br /&gt;#Connect to the site&lt;br /&gt;Connect-PnPOnline -Url $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;#Get the data from CSV file&lt;br /&gt;$CSVFile = Import-CSV $CSVFilePath | Sort-Object ParentFolderSiteRelativeURL -Descending&lt;br /&gt;  &lt;br /&gt;#Read CSV file and delete each folder&lt;br /&gt;ForEach($Row in $CSVFile)&lt;br /&gt;{&lt;br /&gt;    Try {&lt;br /&gt;        #Check if folder exists&lt;br /&gt;        $Folder  = Get-PnPFolderItem -FolderSiteRelativeUrl $Row.ParentFolderSiteRelativeURL -ItemName $Row.FolderName #-ErrorAction SilentlyContinue&lt;br /&gt;        If($Folder -ne $Null)&lt;br /&gt;        {&lt;br /&gt;            #Delete the folder        &lt;br /&gt;            Remove-PnPFolder -Name $Row.FolderName -Folder $Row.ParentFolderSiteRelativeURL -Recycle -Force&lt;br /&gt;            Write-host -f Green &quot;Folder &#39;$($Row.FolderName)&#39; Deleted Successfully from $($Row.ParentFolderSiteRelativeURL)&quot;&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-Host &quot;Folder &#39;$($Row.FolderName)&#39; doesn&#39;t exists at $($Row.ParentFolderSiteRelativeURL)&quot; -ForegroundColor Yellow&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        write-host -f Red &quot;`tError:&quot; $_.Exception.Message&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Here is my CSV file with list of folder names and the site relative URL of its parent folder.&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-jk9mvu276cw/XwB71-rjgkI/AAAAAAAAS7c/bKX0B9hEviMOMVTkqP7CjY4OVM2i8dLewCK4BGAsYHg/s685/SharePoint%2BOnline%2BBulk%2BDelete%2BFolders.png&quot;&gt;&lt;img alt=&quot;SharePoint Online Bulk Delete Folders&quot; border=&quot;0&quot; data-original-height=&quot;405&quot; data-original-width=&quot;685&quot; src=&quot;https://1.bp.blogspot.com/-jk9mvu276cw/XwB71-rjgkI/AAAAAAAAS7c/bKX0B9hEviMOMVTkqP7CjY4OVM2i8dLewCK4BGAsYHg/d/SharePoint%2BOnline%2BBulk%2BDelete%2BFolders.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can download the CSV to delete folders: &lt;a href=&quot;https://sites.google.com/site/salaudeenar/BulkDeleteFolders.csv?attredirects=0&amp;amp;d=1&quot; target=&quot;_blank&quot;&gt;CSV to Bulk Delete Folders in SharePoint Online&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;SharePoint Online: Can&#39;t Delete Folder with Files?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;The above script absolutely works fine when your site is not placed under any retention hold policies. However you got to delete all files and sub-folders of the folder to avoid &quot;You have to delete all the items in this folder before you can delete this folder.&quot; error message. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;SharePoint Online: PowerShell script to Bulk Delete Folders from a CSV File&lt;/b&gt;&lt;/div&gt;&lt;div&gt;This PowerShell script recursively deletes each folder and its contents (files, sub-folders) from the CSV file in a given site.&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Set Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/Marketing&quot;&lt;br /&gt;$CSVFilePath = &quot;C:\Users\Thomas\Desktop\BulkDeleteFolders.csv&quot;&lt;br /&gt;&lt;br /&gt;#Function to delete all Files and sub-folders from a Folder&lt;br /&gt;Function Empty-PnPFolder($Folder)&lt;br /&gt;{&lt;br /&gt;    #Get the site relative path of the Folder&lt;br /&gt;    If($Folder.Context.Web.ServerRelativeUrl -eq &quot;/&quot;)&lt;br /&gt;    {&lt;br /&gt;        $FolderSiteRelativeURL = $Folder.ServerRelativeUrl&lt;br /&gt;    }&lt;br /&gt;    Else&lt;br /&gt;    {        &lt;br /&gt;        $FolderSiteRelativeURL = $Folder.ServerRelativeUrl.Replace($Folder.Context.Web.ServerRelativeURL,&quot;&quot;)&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    #Delete all files in the Folder&lt;br /&gt;    $Files = Get-PnPFolderItem -FolderSiteRelativeUrl $FolderSiteRelativeURL -ItemType File&lt;br /&gt;    ForEach ($File in $Files)&lt;br /&gt;    {&lt;br /&gt;        #Delete File&lt;br /&gt;        Remove-PnPFile -ServerRelativeUrl $File.ServerRelativeURL -Force -Recycle&lt;br /&gt;        Write-Host -f Green (&quot;`tDeleted File: &#39;{0}&#39; at &#39;{1}&#39;&quot; -f $File.Name, $File.ServerRelativeURL)        &lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    #Process all Sub-Folders&lt;br /&gt;    $SubFolders = Get-PnPFolderItem -FolderSiteRelativeUrl $FolderSiteRelativeURL -ItemType Folder&lt;br /&gt;    Foreach($SubFolder in $SubFolders)&lt;br /&gt;    {&lt;br /&gt;        #Exclude &quot;Forms&quot; and Hidden folders&lt;br /&gt;        If(($SubFolder.Name -ne &quot;Forms&quot;) -and (-Not($SubFolder.Name.StartsWith(&quot;_&quot;))))&lt;br /&gt;        {&lt;br /&gt;            #Call the function recursively&lt;br /&gt;            Empty-PnPFolder -Folder $SubFolder&lt;br /&gt; &lt;br /&gt;            #Delete the folder&lt;br /&gt;            Remove-PnPFolder -Name $SubFolder.Name -Folder $FolderSiteRelativeURL -Force -Recycle&lt;br /&gt;            Write-Host -f Green (&quot;`tDeleted Folder: &#39;{0}&#39; at &#39;{1}&#39;&quot; -f $SubFolder.Name, $SubFolder.ServerRelativeURL)&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;  &lt;br /&gt;#Connect to the site&lt;br /&gt;Connect-PnPOnline -Url $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;#Get the data from CSV file&lt;br /&gt;$CSVFile = Import-CSV $CSVFilePath | Sort-Object ParentFolderSiteRelativeURL -Descending&lt;br /&gt;  &lt;br /&gt;#Read CSV file and delete each folder&lt;br /&gt;ForEach($Row in $CSVFile)&lt;br /&gt;{&lt;br /&gt;    Try {&lt;br /&gt;        #Check if folder exists&lt;br /&gt;        $Folder  = Get-PnPFolderItem -FolderSiteRelativeUrl $Row.ParentFolderSiteRelativeURL -ItemName $Row.FolderName #-ErrorAction SilentlyContinue&lt;br /&gt;        If($Folder -ne $Null)&lt;br /&gt;        {&lt;br /&gt;            Write-Host -f Yellow &quot;Deleting Folder &#39;$($Row.FolderName)&#39; from $($Row.ParentFolderSiteRelativeURL)...&quot;&lt;br /&gt;            #Empty the Folder&lt;br /&gt;            Empty-PnPFolder $Folder&lt;br /&gt;&lt;br /&gt;            #Delete the folder&lt;br /&gt;            Remove-PnPFolder -Name $Row.FolderName -Folder $Row.ParentFolderSiteRelativeURL -Recycle -Force&lt;br /&gt;            Write-host -f Green &quot;`tFolder &#39;$($Row.FolderName)&#39; Deleted Successfully!&quot;&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-Host &quot;Folder &#39;$($Row.FolderName)&#39; doesn&#39;t exists at $($Row.ParentFolderSiteRelativeURL)&quot; -ForegroundColor Yellow&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        write-host -f Red &quot;`tError:&quot; $_.Exception.Message&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;This script deletes all files, sub-folders first and then deletes folder in SharePoint Online.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To bulk delete files from a CSV file, use: &lt;a href=&quot;https://www.sharepointdiary.com/2020/01/sharepoint-online-bulk-delete-files-from-csv-using-powershell.html&quot;&gt; SharePoint Online: Bulk Delete Files from a CSV using PowerShell&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/4016287000670175046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-bulk-delete-folders-using-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/4016287000670175046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/4016287000670175046'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-bulk-delete-folders-using-powershell.html' title=' SharePoint Online: Bulk Delete Folders from a CSV using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-1463064083273499055</id><published>2020-01-03T14:07:00.006+05:30</published><updated>2020-07-03T15:21:16.699+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSV"/><category scheme="http://www.blogger.com/atom/ns#" term="List"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>SharePoint Online: Create Multiple Lists from a CSV File using PowerShell</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Bulk create lists in SharePoint Online from a CSV File.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;How to Create Multiple lists from CSV File?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;We can use the combination of CSV and PowerShell to create multiple lists in bulk in SharePoint Online. Here is my CSV File:&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-ZMYbOyPwVng/Xv7-Bm0e8FI/AAAAAAAAS5w/NCgtdxOXqWYS3WR4H588hjhnfNSFh-BuACK4BGAsYHg/s663/sharepoint%2Bonline%2Bcreate%2Blist%2Bfrom%2Bcsv.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;sharepoint online create list from csv&quot; border=&quot;0&quot; data-original-height=&quot;268&quot; data-original-width=&quot;663&quot; src=&quot;https://1.bp.blogspot.com/-ZMYbOyPwVng/Xv7-Bm0e8FI/AAAAAAAAS5w/NCgtdxOXqWYS3WR4H588hjhnfNSFh-BuACK4BGAsYHg/d/sharepoint%2Bonline%2Bcreate%2Blist%2Bfrom%2Bcsv.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can download this CSV here: &lt;a href=&quot;https://sites.google.com/site/salaudeenar/ListCreationTemplate.csv?attredirects=0&amp;amp;d=1&quot; target=&quot;_blank&quot;&gt;SharePoint Online CSV Template to Create Multiple Lists&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;PowerShell to Create Multiple lists from CSV File&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;Use this PnP PowerShell to create SharePoint lists from csv. &lt;pre class=&quot;brush:ps&quot;&gt;#Set Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/Marketing&quot;&lt;br /&gt;$CSVFilePath = &quot;C:\Documents\ListCreationTemplate.csv&quot;&lt;br /&gt;  &lt;br /&gt;#Connect to the site&lt;br /&gt;Connect-PnPOnline -Url $SiteURL -UseWebLogin&lt;br /&gt;&lt;br /&gt;#Get the data from CSV file&lt;br /&gt;$CSVFile = Import-CSV $CSVFilePath&lt;br /&gt;  &lt;br /&gt;#Read CSV file and create List&lt;br /&gt;ForEach($Row in $CSVFile)&lt;br /&gt;{&lt;br /&gt;    Try {&lt;br /&gt;        #Create List&lt;br /&gt;        Write-host -f Yellow &quot;Creating List:&quot;$Row.ListName&lt;br /&gt;        If($Row.OnQuickLaunch -eq &quot;True&quot;)&lt;br /&gt;        {&lt;br /&gt;            New-PnPList -Title $Row.ListName -Template $Row.Template -OnQuickLaunch -ErrorAction Stop | Out-Null&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            New-PnPList -Title $Row.ListName -Template $Row.Template -ErrorAction Stop | Out-Null&lt;br /&gt;        }&lt;br /&gt;        Write-host -f Green &quot;`tCreated List &#39;$($Row.ListName)&#39;&quot;&lt;br /&gt;    }&lt;br /&gt;    Catch {&lt;br /&gt;        write-host -f Red &quot;`tError:&quot; $_.Exception.Message&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;  &lt;div&gt;This CSV file has ListName, Description, Template, OnQuickLaunch columns. You can add any necessary columns as the parameter for creating list.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Tail: How to Get All Values from an Enumerator?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;If you want get all values from an enum, use the below PowerShell script. In my case, I had to retrieve all list template types.&lt;br /&gt;&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Get All Values from the Enum&lt;br /&gt;Function Get-EnumValues([string]$Enumerator)&lt;br /&gt;{&lt;br /&gt;    $EnumValues = @{}&lt;br /&gt;    [Enum]::GetValues([Type]$Enumerator) | ForEach-Object {&lt;br /&gt;        $EnumValues.add($_, $_.value__)&lt;br /&gt;    }&lt;br /&gt;    $EnumValues&lt;br /&gt;}&lt;br /&gt;Get-EnumValues -Enumerator &quot;Microsoft.SharePoint.Client.ListTemplateType&quot;&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;You can also use: GetEnumValues() method of the enumerator. E.g.&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;[Microsoft.SharePoint.Client.ListTemplateType].GetEnumValues()&lt;/pre&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/1463064083273499055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-create-multiple-lists-from-csv-using-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/1463064083273499055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/1463064083273499055'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-create-multiple-lists-from-csv-using-powershell.html' title='SharePoint Online: Create Multiple Lists from a CSV File using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-5271332813436643644</id><published>2020-01-02T22:20:00.004+05:30</published><updated>2020-07-04T01:57:28.219+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Client Side Object Model (CSOM)"/><category scheme="http://www.blogger.com/atom/ns#" term="CSV"/><category scheme="http://www.blogger.com/atom/ns#" term="Document Library"/><category scheme="http://www.blogger.com/atom/ns#" term="File"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>SharePoint Online: Bulk Delete Files from a CSV using PowerShell</title><content type='html'>&lt;b&gt;Requirement: &lt;/b&gt;Delete multiple files from SharePoint Online document libraries from a CSV using PowerShell.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to Delete Multiple Files in SharePoint Online Site from a CSV file?&lt;/b&gt;&lt;br /&gt;We have a CSV file with a list of URLs of various files in multiple document libraries in SharePoint Online. I wanted to bulk delete them. Here is my CSV file format: It has &quot;FileName&quot; and &quot;ServerRelativeURL&quot; as columns. &lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-oKl3Cu3Tb50/Xsv3O7BlBlI/AAAAAAAASL0/LQJtv0U5kz4ITt7V1iQ55iqV73m1okeAQCK4BGAsYHg/powershell%2Bto%2Bbulk%2Bdelete%2Bfiles%2Bin%2Bsharepoint%2Bonline.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;powershell to bulk delete files in sharepoint online&quot; border=&quot;0&quot; data-original-height=&quot;414&quot; data-original-width=&quot;979&quot; src=&quot;https://1.bp.blogspot.com/-oKl3Cu3Tb50/Xsv3O7BlBlI/AAAAAAAASL0/LQJtv0U5kz4ITt7V1iQ55iqV73m1okeAQCK4BGAsYHg/d/powershell%2Bto%2Bbulk%2Bdelete%2Bfiles%2Bin%2Bsharepoint%2Bonline.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;You can download the CSV template at: &lt;a href=&quot;https://sites.google.com/site/salaudeenar/BulkDeleteFiles.csv?attredirects=0&amp;amp;d=1&quot; id=&quot;PowerShell to Bulk delete files from CSV in SharePoint Online&quot; name=&quot;PowerShell to Bulk delete files from CSV in SharePoint Online&quot; target=&quot;_blank&quot;&gt;CSV to Bulk Delete Files in SharePoint Online&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PowerShell to Remove Files using a CSV file in SharePoint Online:&lt;/b&gt;&lt;br /&gt;This PowerShell script deletes each file from the CSV file in a given site. &lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Parameters&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/marketing&quot;&lt;br /&gt;$CSVFilePath = &quot;C:\Temp\BulkDeleteFiles.csv&quot;&lt;br /&gt;&lt;br /&gt;#Get Credentials to connect&lt;br /&gt;$Cred = Get-Credential&lt;br /&gt;&lt;br /&gt;Try {&lt;br /&gt;    #Connect to PnP Online&lt;br /&gt;    Connect-PnPOnline -Url $SiteURL -Credentials $Cred&lt;br /&gt;&lt;br /&gt;    #Read from CSV file and delete&lt;br /&gt;    Import-CSV $CSVFilePath | ForEach-Object {&lt;br /&gt;        #Check if File exists&lt;br /&gt;        $File = Get-PnPFile -ServerRelativeUrl $_.ServerRelativeUrl -ErrorAction SilentlyContinue &lt;br /&gt;        If($File)&lt;br /&gt;        {&lt;br /&gt;            #Delete the File - Send to Recycle bin without prompting&lt;br /&gt;            Remove-PnPFile -ServerRelativeUrl $_.ServerRelativeURL -Recycle -Force&lt;br /&gt;            Write-Host &quot;Deleted File &#39;$($_.FileName)&#39; at $($_.ServerRelativeUrl)&quot; -ForegroundColor Green&lt;br /&gt;        }&lt;br /&gt;        Else&lt;br /&gt;        {&lt;br /&gt;            Write-Host &quot;File &#39;$($_.FileName)&#39; doesn&#39;t exists at $($_.ServerRelativeUrl)&quot; -ForegroundColor Yellow&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;catch {&lt;br /&gt;    write-host &quot;Error: $($_.Exception.Message)&quot; -foregroundcolor Red&lt;br /&gt;}&lt;br /&gt;  &lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/5271332813436643644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-bulk-delete-files-from-csv-using-powershell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/5271332813436643644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/5271332813436643644'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/sharepoint-online-bulk-delete-files-from-csv-using-powershell.html' title='SharePoint Online: Bulk Delete Files from a CSV using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-5413418396304366821</id><published>2020-01-02T15:11:00.005+05:30</published><updated>2020-07-02T20:20:04.261+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Errors"/><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><title type='text'>Fix &quot;Import-Module: The specified module was not loaded because no valid module file was found in any module directory&quot; Error</title><content type='html'>&lt;div&gt;&lt;b&gt;Problem&lt;/b&gt;: When trying to import the PnP PowerShell module, got an error message &quot;Import-Module: The specified module &#39;SharePointPnPPowerShellOnline&#39; was not loaded because no valid module file was found in any module directory&quot;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-IPdeTkZ4c1Q/Xv2rtFovZ_I/AAAAAAAAS4Q/nL_R7iyTtBslR6zhWiw_qfIVFgn-TZn7gCK4BGAsYHg/s1294/Import-Module%2BThe%2Bspecified%2Bmodule%2Bwas%2Bnot%2Bloaded%2Bbecause%2Bno%2Bvalid%2Bmodule%2Bfile%2Bwas%2Bfound%2Bin%2Bany%2Bmodule%2Bdirectory.png&quot;&gt;&lt;img alt=&quot;Import-Module: The specified module was not loaded because no valid module file was found in any module directory&quot; border=&quot;0&quot; data-original-height=&quot;774&quot; data-original-width=&quot;1294&quot; src=&quot;https://1.bp.blogspot.com/-IPdeTkZ4c1Q/Xv2rtFovZ_I/AAAAAAAAS4Q/nL_R7iyTtBslR6zhWiw_qfIVFgn-TZn7gCK4BGAsYHg/d/Import-Module%2BThe%2Bspecified%2Bmodule%2Bwas%2Bnot%2Bloaded%2Bbecause%2Bno%2Bvalid%2Bmodule%2Bfile%2Bwas%2Bfound%2Bin%2Bany%2Bmodule%2Bdirectory.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br/&gt;&lt;b&gt;Solution:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;This is because the PowerShell console or ISE is unable to get the module from given module path&#39;s in the environment variable &quot;PSModulePath&quot;. To fix the issue, You have to make sure your custom module&#39;s path is appended to the PSModulePath.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Step 1:&lt;/b&gt; Get the Path of your custom PowerShell Module&lt;/div&gt;&lt;div&gt;Make sure you have the custom module installed already, To get the modules installed, Open PowerShell console and type:&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;Get-module -ListAvailable&lt;/pre&gt;&lt;div&gt;This gets all installed modules in your system along with their installed Path. Get the path of your custom module as highlighted. In my case, the PnP PowerShell module was installed at &quot;C:\Program Files\WindowsPowerShell\Modules&quot;.&lt;/div&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-isUCHd9uKqU/Xv2rsr40ugI/AAAAAAAAS4M/_4KdmuwD81EJGG9Q7WRghLhO-XQDFcUNQCK4BGAsYHg/s1341/Get%2Binstalled%2Bmodules%2Bin%2BPowershell.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Get-module -ListAvailable&quot; border=&quot;0&quot; data-original-height=&quot;699&quot; data-original-width=&quot;1341&quot; src=&quot;https://1.bp.blogspot.com/-isUCHd9uKqU/Xv2rsr40ugI/AAAAAAAAS4M/_4KdmuwD81EJGG9Q7WRghLhO-XQDFcUNQCK4BGAsYHg/d/Get%2Binstalled%2Bmodules%2Bin%2BPowershell.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;b&gt;Step 2:&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;As far next step, We&#39;ve to verify if our custom module&#39;s path is added in the &quot;PSModulePath&quot; variable.&lt;/div&gt;&lt;div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Go to System Properties (Windows Key + Pause Break) &amp;gt;&amp;gt; Click on Advanced System Settings &amp;gt;&amp;gt; Click on Environment Variables&lt;/li&gt;&lt;li&gt;Pick &quot;PSModulePath&quot; and click on &quot;Edit&quot; button.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-FcPe6ax74bY/Xv3yAlvXvfI/AAAAAAAAS40/6itTx5c1YnYupHakDjfL0_E1JioUtg9jQCK4BGAsYHg/s618/PSModulePath.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;add path to PSModulePath variable&quot; border=&quot;0&quot; data-original-height=&quot;585&quot; data-original-width=&quot;618&quot; src=&quot;https://1.bp.blogspot.com/-FcPe6ax74bY/Xv3yAlvXvfI/AAAAAAAAS40/6itTx5c1YnYupHakDjfL0_E1JioUtg9jQCK4BGAsYHg/d/PSModulePath.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Add the the path to this variable. In my case, its &quot;C:\Program Files\WindowsPowerShell\Modules&quot;&lt;/li&gt;&lt;li&gt;Restart PowerShell ISE or PowerShell console. &lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;This should solve the problem.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/5413418396304366821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/import-module-specified-module-not-loaded-because-no-valid-module-file-found-in-any-module-directory.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/5413418396304366821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/5413418396304366821'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/import-module-specified-module-not-loaded-because-no-valid-module-file-found-in-any-module-directory.html' title='Fix &quot;Import-Module: The specified module was not loaded because no valid module file was found in any module directory&quot; Error'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-4851471228234122817</id><published>2020-01-02T15:08:00.019+05:30</published><updated>2020-06-29T23:30:21.156+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>How to Use a Encrypted Password File in PowerShell Scripts?</title><content type='html'>&lt;div&gt;&lt;b&gt;Requirement: &lt;/b&gt;Use a encrypted password file in PowerShell scripts.&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-ymXByAvj4jc/XvonAfQyuHI/AAAAAAAAS0M/LB6V_Ag_tPITTA_GG2Z5oX0SzpasXXqOwCK4BGAsYHg/s850/How%2Bto%2BUse%2Ba%2BEncrypted%2BPassword%2BFile%2Bin%2BPowerShell%2BScripts.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;How to Use a Encrypted Password File in PowerShell Scripts?&quot; border=&quot;0&quot; data-original-height=&quot;315&quot; data-original-width=&quot;850&quot; src=&quot;https://1.bp.blogspot.com/-ymXByAvj4jc/XvonAfQyuHI/AAAAAAAAS0M/LB6V_Ag_tPITTA_GG2Z5oX0SzpasXXqOwCK4BGAsYHg/d/How%2Bto%2BUse%2Ba%2BEncrypted%2BPassword%2BFile%2Bin%2BPowerShell%2BScripts.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;How to use a Encrypted Password File to Read/Write Credentials in PowerShell?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;PowerShell modules like PnP PowerShell offers a mechanism to use &lt;a href=&quot;https://www.sharepointdiary.com/2018/03/connect-to-sharepoint-online-using-pnp-powershell.html&quot;&gt;Windows credentials store to Save and retrieve user name and password&lt;/a&gt; to use it in scripts. However, for other PowerShell modules like SharePoint Online Management Shell, AzureAD, CSOM. etc. we don&#39;t have any direct ways to suppress the password prompt, other than storing the password in plain text within the script. In situations like we need to schedule the script in Windows task scheduler, for unattended execution of the script without any user intervention, we can use this method:&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is how we can store and read encrypted passwords from file in PowerShell scripts.&lt;br /&gt;&lt;div class=&quot;important&quot;&gt;MFA must be turn-off for the saved credentials to work!&lt;/div&gt; &lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Step 1:&lt;/b&gt; Create a encrypted password file to store credentials&lt;/li&gt;&lt;li&gt;&lt;b&gt;Step 2:&lt;/b&gt; Read the encrypted password from the file and use it in scripts.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;Create a Encrypted Password File&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Basically, we need to get the credentials from the user (once!) and store the encrypted password to a file. Here is the PowerShell script to save encrypted password to a file.&lt;br /&gt;&lt;/div&gt;  &lt;pre class=&quot;brush:ps&quot;&gt;#function to Save Credentials to a file&lt;br /&gt;Function Save-Credential([string]$UserName, [string]$KeyPath)&lt;br /&gt;{&lt;br /&gt;    #Create directory for Key file&lt;br /&gt;    If (!(Test-Path $KeyPath)) {        &lt;br /&gt;        Try {&lt;br /&gt;            New-Item -ItemType Directory -Path $KeyPath -ErrorAction STOP | Out-Null&lt;br /&gt;        }&lt;br /&gt;        Catch {&lt;br /&gt;            Throw $_.Exception.Message&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    #store password encrypted in file&lt;br /&gt;    $Credential = Get-Credential -Message &quot;Enter the Credentials:&quot; -UserName $UserName&lt;br /&gt;    $Credential.Password | ConvertFrom-SecureString | Out-File &quot;$($KeyPath)\$($Credential.Username).cred&quot; -Force&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Get credentials and create a encrypted password file&lt;br /&gt;Save-Credential -UserName &quot;salaudeen@crescent.com&quot; -KeyPath &quot;C:\Scripts&quot;&lt;br /&gt;&lt;/pre&gt;  &lt;div&gt;This creates a file with encrypted credentials on given path.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Get the encrypted password from the File&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once we create the encrypted password file, we can read the file and use the saved credentials in our scripts like:&lt;/div&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#function to get credentials from a Saved file&lt;br /&gt;Function Get-SavedCredential([string]$UserName,[string]$KeyPath)&lt;br /&gt;{&lt;br /&gt;    If(Test-Path &quot;$($KeyPath)\$($Username).cred&quot;) {&lt;br /&gt;        $SecureString = Get-Content &quot;$($KeyPath)\$($Username).cred&quot; | ConvertTo-SecureString&lt;br /&gt;        $Credential = New-Object System.Management.Automation.PSCredential -ArgumentList $Username, $SecureString&lt;br /&gt;    }&lt;br /&gt;    Else {&lt;br /&gt;        Throw &quot;Unable to locate a credential for $($Username)&quot;&lt;br /&gt;    }&lt;br /&gt;    Return $Credential&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#Get encrypted password from file&lt;br /&gt;$Cred = Get-SavedCredential -UserName &quot;salaudeen@crescent.com&quot; -KeyPath &quot;C:\Scripts&quot;&lt;br /&gt;&lt;br /&gt;#Connect to Azure AD from saved credentials&lt;br /&gt;Connect-AzureAD -Credential $Cred    &lt;/pre&gt;  &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Alright, here is how we can use this method to connect to SharePoint Online Management Shell:&lt;/div&gt;    &lt;pre class=&quot;brush:ps&quot;&gt;#Get encrypted password from file&lt;br /&gt;$Cred = Get-SavedCredential -UserName &quot;salaudeen@crescent.com&quot; -KeyPath &quot;C:\Scripts&quot;&lt;br /&gt;&lt;br /&gt;#Connect to SharePoint Online PowerShell&lt;br /&gt;Connect-SPOService -URL &quot;https://crescentintranet-admin.sharepoint.com&quot; -Credential $Cred&lt;br /&gt;&lt;br /&gt;#Get all Site Collections&lt;br /&gt;Get-SPOSite&lt;br /&gt;    &lt;/pre&gt;  Similarly, to connect to SharePoint Online using CSOM PowerShell, use:   &lt;pre class=&quot;brush:ps&quot;&gt;Import-Module Microsoft.Online.SharePoint.PowerShell&lt;br /&gt;&lt;br /&gt;#Get encrypted password from file&lt;br /&gt;$Cred = Get-SavedCredential -UserName &quot;salaudeen@crescent.com&quot; -KeyPath &quot;C:\Scripts&quot;&lt;br /&gt;&lt;br /&gt;#Parameter&lt;br /&gt;$SiteUrl = &quot;https://crescentintranet.sharepoint.com/sites/marketing&quot;&lt;br /&gt;    &lt;br /&gt;#Set up the context&lt;br /&gt;$Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)&lt;br /&gt;$Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)&lt;br /&gt; &lt;br /&gt;#Get the Web Object&lt;br /&gt;$Web = $Ctx.web&lt;br /&gt;$Ctx.Load($Web)&lt;br /&gt;$Ctx.ExecuteQuery()&lt;br /&gt; &lt;br /&gt;#Get the Title of the Web&lt;br /&gt;Write-host $Web.Title  &lt;/pre&gt;  &lt;div&gt;I used it in automated PowerShell scripts that&#39;s scheduled in Windows task scheduler. E.g. PowerShell to import custom user profile properties from Azure AD to SharePoint Online user profile store.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/4851471228234122817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/read-write-encrypted-password-file-in-powershell-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/4851471228234122817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/4851471228234122817'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/read-write-encrypted-password-file-in-powershell-script.html' title='How to Use a Encrypted Password File in PowerShell Scripts?'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-8401285971636339943</id><published>2020-01-01T13:57:00.000+05:30</published><updated>2020-01-07T14:03:55.403+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><title type='text'>Getting Started with Home Site in SharePoint Online</title><content type='html'>&lt;b&gt;What is Home Site in SharePoint Online?&lt;/b&gt; &lt;br /&gt;Homesite in SharePoint Online is the top landing page for your organization at &lt;b&gt;https://tenant.sharepoint.com/_layouts/15/sharepoint.aspx&lt;/b&gt;. The new &lt;b&gt;Set-SPOHomeSite&lt;/b&gt; cmdlet sets a modern communication site collection as the SharePoint Online landing page for your organization! So when you click &quot;SharePoint&quot; from the tiles in Office 365 app launcher, you&#39;ll be taken into the SharePoint Home branded from your communication site. Please note, It takes only the branding, Logo, navigation and footer from the communication site, but the default SharePoint Home content like News, Sites, Events, etc. stays as is.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-PoOHGEwNvTc/XhQ5HBweK1I/AAAAAAAARFA/P0UpKKMRlicustc-jZpfa61KrinifscPQCLcBGAsYHQ/s1600/Set-SPOHomeSite.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1035&quot; data-original-width=&quot;1277&quot; src=&quot;https://1.bp.blogspot.com/-PoOHGEwNvTc/XhQ5HBweK1I/AAAAAAAARFA/P0UpKKMRlicustc-jZpfa61KrinifscPQCLcBGAsYHQ/s1600/Set-SPOHomeSite.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt; &lt;br /&gt;Technically you can set any communication site a home site, but making the &quot;root&quot; site of your tenant as the home site makes sense probably. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;What&#39;s Special About Home Site?&lt;/b&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;The SharePoint Homesite can be used as a global search center to search among all SharePoint sites organization-wide.&amp;nbsp;&lt;/li&gt;&lt;li&gt;It acts as an enterprise-wide news portal that collates news from all sites. Also, it enables SharePoint mobile app experience for that site.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Enabling home site adds home icon to your SharePoint mobile app. The mobile app gets updated with a home button on the Find tab Search box and that will take you to the organization&#39;s new SharePoint Homesite. &lt;/li&gt;&lt;/ul&gt;&lt;b&gt;How to Set Home Site in SharePoint Online?&lt;/b&gt; &lt;br /&gt;Make sure you have the latest version of SharePoint Online PowerShell module installed, Run this PowerShell script to set Homesite in SharePoint Online. Log in as a tenant admin and designate any communication site to be the landing page for your organization, one home site per tenant.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;$AdminSiteURL = &quot;https://crescent-admin.sharepoint.com/&quot;&lt;br /&gt;$HomeSiteURL = &quot;https://crescent.sharepoint.com&quot;&lt;br /&gt;&lt;br /&gt;#Connect to the Site&lt;br /&gt;Connect-SPOService -URL $AdminSiteURL -Credential (Get-Credential)&lt;br /&gt;&lt;br /&gt;#Set Home Site&lt;br /&gt;Set-SPOHomeSite -HomeSiteUrl $HomeSiteURL&lt;/pre&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-vpooxSEEMkE/Xg78hMYdodI/AAAAAAAARCk/k8bRZ5cEiLYOYdba2FimMtMTbah3p8CcwCLcBGAsYHQ/s1600/Set-Set-SPOHomeSite.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;174&quot; data-original-width=&quot;647&quot; src=&quot;https://1.bp.blogspot.com/-vpooxSEEMkE/Xg78hMYdodI/AAAAAAAARCk/k8bRZ5cEiLYOYdba2FimMtMTbah3p8CcwCLcBGAsYHQ/s1600/Set-Set-SPOHomeSite.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Once you run the above script, The Out-of-Box SharePoint Online starter landing page powered by graph intelligence to get news, sites, documents and items saved for later and all personalized itesm available for all users gets replaced with the communication site design. It also adds &quot;My SharePoint&quot; link to your existing communication sites which links to the personal SharePoint start page.&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/8401285971636339943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2020/01/how-to-set-home-site-in-sharepoint-online.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/8401285971636339943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/8401285971636339943'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2020/01/how-to-set-home-site-in-sharepoint-online.html' title='Getting Started with Home Site in SharePoint Online'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-PoOHGEwNvTc/XhQ5HBweK1I/AAAAAAAARFA/P0UpKKMRlicustc-jZpfa61KrinifscPQCLcBGAsYHQ/s72-c/Set-SPOHomeSite.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-903616810236979972.post-6847527405386989565</id><published>2019-12-25T20:56:00.002+05:30</published><updated>2020-01-19T02:41:33.547+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PnP PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="SharePoint Online"/><category scheme="http://www.blogger.com/atom/ns#" term="Site Collection"/><title type='text'>Create a Communication Site in SharePoint Online using PowerShell</title><content type='html'>&lt;b&gt;Requirement: &lt;/b&gt;Create a communication site in SharePoint Online using PowerShell&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to Create a Communication Site in SharePoint Online?&lt;/b&gt;&lt;br /&gt;One of the recent addition to SharePoint Online space is Communication sites! The modern SharePoint Online communication site templates are designed to broadcast information to a broader audience such as to an entire organization or teams to keep them informed and engaged. You can share news, reports, images, documents, organizational events and other information in a visually compelling format that communicates key information into one central place. A communication site is more visual-centric, dynamic sites that look great on the web, on a PC or Mac, on mobile browsers, and in the SharePoint app. Communication sites allow people to create and share timely updates that go beyond email, Anyone can easily create communicate sites and customize within 30 minutes!&lt;br /&gt;&lt;br /&gt;Communication sites provide configurable templates for the sites and pages to make your life easy while communicating messages to a large audience. When you create a communication site in SharePoint, you can start with a blank site or choose one of the available site designs, each of which comes with a default set of web parts with preset designs to help users get started, faster. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Create a New Communication Site in SharePoint Online&lt;/b&gt;&lt;br /&gt;To create a communication site in SharePoint Online, follow these steps:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Login to New SharePoint Admin Center as a tenant admin or SharePoint Online Administrator.&amp;nbsp;&lt;/li&gt;&lt;li&gt;Click on &quot;Sites&quot; &amp;gt;&amp;gt; &quot;Active Sites&quot; from left navigation &amp;gt;&amp;gt;  Click on &quot;Create&quot; &amp;gt;&amp;gt; From the&amp;nbsp; options available, choose &quot;Communication Site &quot; to create a  new communication site collection.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-Q2usvpMT8xg/XgN9swfmMII/AAAAAAAAQ9o/87WcOatzoBQ-wMcdGbHOVSlRVhoBOa2XACEwYBhgL/s1600/create%2Bcommunication%2Bsite%2Bsharepoint%2Bonline%2Bpowershell.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;create communication site sharepoint online powershell&quot; border=&quot;0&quot; data-original-height=&quot;771&quot; data-original-width=&quot;1222&quot; src=&quot;https://1.bp.blogspot.com/-Q2usvpMT8xg/XgN9swfmMII/AAAAAAAAQ9o/87WcOatzoBQ-wMcdGbHOVSlRVhoBOa2XACEwYBhgL/s1600/create%2Bcommunication%2Bsite%2Bsharepoint%2Bonline%2Bpowershell.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Give the site a name, which becomes the URL of the site. You can edit URL as well below it if needed. These sites are created under the /sites managed path by default.&lt;/li&gt;&lt;li&gt;Choose a template for your site - it is just a starting layout, you can change it later anyway. I&#39;ve selected &quot;Topic&quot; here!&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-LkfvVlCbQCA/XgN9tzRn1CI/AAAAAAAAQ9s/bMkiwH1Wkbc49f4yqdvj26aKgHW0nIjEQCEwYBhgL/s1600/how%2Bto%2Bcreate%2Bcommunication%2Bsite%2Bin%2Bsharepoint%2Bonline.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;how to create communication site in sharepoint online&quot; border=&quot;0&quot; data-original-height=&quot;771&quot; data-original-width=&quot;1219&quot; src=&quot;https://1.bp.blogspot.com/-LkfvVlCbQCA/XgN9tzRn1CI/AAAAAAAAQ9s/bMkiwH1Wkbc49f4yqdvj26aKgHW0nIjEQCEwYBhgL/s1600/how%2Bto%2Bcreate%2Bcommunication%2Bsite%2Bin%2Bsharepoint%2Bonline.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Optionally, under the &quot;Advanced settings&quot;, select the language and set the description by adding some text that lets people know the purpose of your site and then click Finish. &lt;/li&gt;&lt;/ul&gt;SharePoint creates the communication site quickly and will appear on the sites list. Now, we can populate it with our own information. When ready, You can share it with other people by adding the permissions and sharing it with others. Communication sites don&#39;t come with an Office 365 group.&amp;nbsp; &lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-Zynkcj4Opjs/XgN9s3xxfPI/AAAAAAAAQ9s/Vh_MZg_tpC4aRc2lRMbpWpTJyNVxq_ybgCEwYBhgL/s1600/create%2Bnew%2Bcommunication%2Bsite%2Bsharepoint%2Bonline.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;create new communication site sharepoint online&quot; border=&quot;0&quot; data-original-height=&quot;936&quot; data-original-width=&quot;1271&quot; src=&quot;https://1.bp.blogspot.com/-Zynkcj4Opjs/XgN9s3xxfPI/AAAAAAAAQ9s/Vh_MZg_tpC4aRc2lRMbpWpTJyNVxq_ybgCEwYBhgL/s1600/create%2Bnew%2Bcommunication%2Bsite%2Bsharepoint%2Bonline.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;You can also use the &quot;SharePoint Home&quot; (https://tenant.sharepoint.com/_layouts/15/sharepoint.aspx) to create communication sites by simply going to: Office 365 App Launcher, click on SharePoint.&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://1.bp.blogspot.com/-YsnUNFI-4RI/XgN9swjjK6I/AAAAAAAAQ9c/XVqoA_ZebUgdqZZWNMERx9RydWgvezVGgCEwYBhgL/s1600/create%2Bmodern%2Bcommunication%2Bsite%2Bsharepoint.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;create modern communication site sharepoint&quot; border=&quot;0&quot; data-original-height=&quot;763&quot; data-original-width=&quot;1136&quot; src=&quot;https://1.bp.blogspot.com/-YsnUNFI-4RI/XgN9swjjK6I/AAAAAAAAQ9c/XVqoA_ZebUgdqZZWNMERx9RydWgvezVGgCEwYBhgL/s1600/create%2Bmodern%2Bcommunication%2Bsite%2Bsharepoint.png&quot; title=&quot;&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Here is where communication site templates fits well:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;A typical Intranet-Extranet-department sites.&lt;/li&gt;&lt;li&gt;News Portals, Product or Service oriented sites,&lt;/li&gt;&lt;li&gt;Campaigns, insights, Events, usiness highlights and reviews&lt;/li&gt;&lt;/ul&gt;Alright, let&#39;s create a communication site in SharePoint Online with PowerShell!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Create SharePoint Online communication site with PowerShell&lt;/b&gt;&lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Define Parameters&lt;br /&gt;$AdminCenterURL = &quot;https://crescent-admin.sharepoint.com/&quot;&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/communications&quot;&lt;br /&gt;$SiteTitle = &quot;Communication Site&quot;&lt;br /&gt;$SiteOwner = &quot;Salaudeen@crescent.com&quot;&lt;br /&gt;&lt;br /&gt;#Connect to SharePoint Online&lt;br /&gt;Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential)&lt;br /&gt;&lt;br /&gt;#PowerShell to Create new communication site&lt;br /&gt;New-SPOSite -Url $SiteURL -Owner $SiteOwner -Template &quot;SITEPAGEPUBLISHING#0&quot; -StorageQuota 2048 -Title $SiteTitle&lt;/pre&gt;Let&#39;s add some error handling to the above script and re-write it in PnP PowerShell.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Create a Communication site in SharePoint Online using PnP PowerShell&lt;/b&gt;&lt;br /&gt;Here is how to create a communication site using PnP PowerShell&lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;New-PnPSite -Type CommunicationSite -Title Intranet -Url https://crescent.sharepoint.com/sites/Intranet -SiteDesign Showcase&lt;/pre&gt;&lt;br /&gt;and bit expanded one goes here: &lt;br /&gt;&lt;pre class=&quot;brush:ps&quot;&gt;#Define Config Variables&lt;br /&gt;$AdminCenterURL = &quot;https://crescent-Admin.sharepoint.com&quot;&lt;br /&gt;$SiteURL = &quot;https://crescent.sharepoint.com/sites/intranet&quot;&lt;br /&gt;$SiteTitle = &quot;Crescent Intranet Portal&quot;&lt;br /&gt;$SiteOwner = &quot;Salaudeen@crescent.com&quot;&lt;br /&gt;$Template = &quot;SITEPAGEPUBLISHING#0&quot; #Communication Site template&lt;br /&gt;$Timezone = 24 #(GMT+04:00) Abu Dhabi, Muscat&lt;br /&gt; &lt;br /&gt;#Get Credentials to connect&lt;br /&gt;$Cred = Get-Credential&lt;br /&gt; &lt;br /&gt;Try&lt;br /&gt;{&lt;br /&gt;    #Connect to Tenant Admin&lt;br /&gt;    Connect-PnPOnline -URL $AdminCenterURL -Credential $Cred&lt;br /&gt;     &lt;br /&gt;    #Check if site exists already&lt;br /&gt;    $Site = Get-PnPTenantSite | Where {$_.Url -eq $SiteURL}&lt;br /&gt; &lt;br /&gt;    If ($Site -eq $null)&lt;br /&gt;    {&lt;br /&gt;        #sharepoint online pnp powershell to create communication site&lt;br /&gt;        New-PnPTenantSite -Url $SiteURL -Owner $SiteOwner -Title $SiteTitle -Template $Template -TimeZone $TimeZone -RemoveDeletedSite&lt;br /&gt;        write-host &quot;Site Collection $($SiteURL) Created Successfully!&quot; -foregroundcolor Green&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;        write-host &quot;Site $($SiteURL) exists already!&quot; -foregroundcolor Yellow&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;catch {&lt;br /&gt;    write-host &quot;Error: $($_.Exception.Message)&quot; -foregroundcolor Red&lt;br /&gt;}&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.sharepointdiary.com/feeds/6847527405386989565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.sharepointdiary.com/2019/12/create-communication-site-in-sharepoint-online-using-powershell.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/6847527405386989565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/903616810236979972/posts/default/6847527405386989565'/><link rel='alternate' type='text/html' href='http://www.sharepointdiary.com/2019/12/create-communication-site-in-sharepoint-online-using-powershell.html' title='Create a Communication Site in SharePoint Online using PowerShell'/><author><name>Salaudeen Rajack</name><uri>http://www.blogger.com/profile/05907410863523688056</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//2.bp.blogspot.com/-pn8bQYCUrT8/UOQQYvyS2fI/AAAAAAAAA-o/nxDpxO4gUus/s1600/Sharepoint-diary-logo.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://1.bp.blogspot.com/-Q2usvpMT8xg/XgN9swfmMII/AAAAAAAAQ9o/87WcOatzoBQ-wMcdGbHOVSlRVhoBOa2XACEwYBhgL/s72-c/create%2Bcommunication%2Bsite%2Bsharepoint%2Bonline%2Bpowershell.png" height="72" width="72"/><thr:total>2</thr:total></entry></feed>