SharePoint Online: Get All Folders from List using PowerShell

September 19, 2018    , , , , ,
Requirement: Get All Folders from a SharePoint Online list using PowerShell PowerShell to Get All Folders in a SharePoint Online List Here is the CAML based approach to get all folders and sub-folders recursively from a list. #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Set Variables $SiteURL = "https://crescent.sharepoint.com/sites/marketing" $ListName = "Documents" #Get Credentials to connect $Cred = Get-Credential Try { #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password) #Get the List $List = $Ctx.web.Lists.GetByTi
SharePoint Online: Get All Folders from List using PowerShell SharePoint Online: Get All Folders from List using PowerShell Reviewed by Salaudeen Rajack on September 19, 2018 Rating: 5

SharePoint Online: Delete Empty Folders using PowerShell

September 18, 2018    , , , ,
Requirement: Delete Empty Folders in SharePoint Online Document Library using PowerShell SharePoint Online: PowerShell to Remove Empty Folders This PowerShell script deletes all empty folders from a given SharePoint Online document library. #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" Function Delete-SPOEmptyFolders([Microsoft.SharePoint.Client.Folder]$Folder) { #Get All Files and Sub-Folders from the Folder $Files = $Folder.Files $SubFolders = $Folder.Folders $Ctx.Load($Files) $Ctx.Load($SubFolders) $Ctx.ExecuteQuery() #Process Each Sub-Folders recursively ForEach($SubFolder in $SubFolders) { Delete-SPOEmptyFolders $SubFolder } #Delete Empty Folders I
SharePoint Online: Delete Empty Folders using PowerShell SharePoint Online: Delete Empty Folders using PowerShell Reviewed by Salaudeen Rajack on September 18, 2018 Rating: 5

SharePoint Online: Share Site and Invite External Users using PowerShell

September 18, 2018    , , , ,
Requirement: Share SharePoint Online Site with Multiple External Users using PowerShell. SharePoint Online: Share with External Users using PowerShell This PowerShell script invites external users to a SharePoint site and grants View permissions within the site. A custom e-mail message also included in invitation email. #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Set Variables $SiteURL = "https://crescent.sharepoint.com/sites/marketing" $Users = "Mark.Ellis@gmail.com","Sayeed.Alhajiri@gmail.com" #Get Credentials to connect $Cred = Get-Credential Try { #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = New-Ob
SharePoint Online: Share Site and Invite External Users using PowerShell SharePoint Online: Share Site and Invite External Users using PowerShell Reviewed by Salaudeen Rajack on September 18, 2018 Rating: 5

SharePoint Online: Create Site Collection from Custom Template

September 16, 2018    , , ,
Requirement: Create Site Collection with Custom Template in SharePoint Online SharePoint Online: Create Site Collection from Custom Template Creating subsites from a custom template is quite straightforward as in my another post: SharePoint Online: Create Subsite from Template using PowerShell . But if you want to create a site collection based on a custom site template, You have to follow below steps: Assuming you have saved a site as template and the Site Template WSP file is ready, here are the steps to create site collection with custom template in SharePoint Online: Step 1: Create New Site Collection without Specifying Site Template Let's create a new site collection with "Select a Template Later" option. Go to your SharePoint Online Admin Center >> Click on "Site Collections" link from left navigation. In the toolbar, Click on "New" >> Private site collection. Provide the URL and other parameters to create the Site Collecti
SharePoint Online: Create Site Collection from Custom Template SharePoint Online: Create Site Collection from Custom Template Reviewed by Salaudeen Rajack on September 16, 2018 Rating: 5

Get SharePoint Online Tenant Settings using PowerShell

September 16, 2018    , , ,
Requirement: Get tenant settings in SharePoint Online PowerShell to Retrieve Tenant Setting in SharePoint Online: Use Get-SPOTenant cmdlet to get all configuration settings of the tenant. #Set SharePoint Online Admin Center URL $AdminSiteURL="https://crescent-admin.sharepoint.com" #Connect to SharePoint Online Admin Center Connect-SPOService -Url $AdminSiteURL -Credential (Get-Credential) #Get Tenant Settings Get-SPOTenant This cmdlet gets all settings of the tenant Get SharePoint Online Tenant Settings using PowerShell: #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" Add-Type -Path "C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.Online.ShareP
Get SharePoint Online Tenant Settings using PowerShell Get SharePoint Online Tenant Settings using PowerShell Reviewed by Salaudeen Rajack on September 16, 2018 Rating: 5

SharePoint Online: Compare Features Between Sites using PowerShell

September 16, 2018    , , ,
Have you even wanted to compare features activated between SharePoint Site collections or sites? Well, this nifty PowerShell script does that exactly! PowerShell to Compare Features Between SharePoint Online Sites or Site Collections #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" Function Compare-SPOFeatures { [cmdletbinding()] Param( [Parameter(Mandatory=$True)][URI]$SourceSiteURL, [Parameter(Mandatory=$True)][URI]$TargetSiteURL, [Parameter(Mandatory=$True)][ValidateSet('Site','Web')][String]$Scope ) #Get Credentials to connect $Cred = Get-Credential #Get Source and Target Site Contexts $SourceCtx = New-Object Microsoft.SharePoint.Client.ClientCon
SharePoint Online: Compare Features Between Sites using PowerShell SharePoint Online: Compare Features Between Sites using PowerShell Reviewed by Salaudeen Rajack on September 16, 2018 Rating: 5

SharePoint Online: Enable SharePoint Designer using PowerShell

September 16, 2018    , , ,
Requirement: Enable SharePoint Designer for a SharePoint Online site. SharePoint Online: How to Enable SharePoint Designer? By default, SharePoint designer customizations are disabled for modern group sites in SharePoint Online. It gives an error message "The server could not complete your request." when you try to open a SharePoint Online group site in SharePoint Designer. Also, It gives "You do not have permission to open this web site in SharePoint Designer" error message: How to Enable SharePoint Designer in SharePoint Online? To enable SharePoint Designer, follow these steps: Sign in to Office 365 and go to the SharePoint Online Admin Center. Click on Settings from the left navigation >> Scroll down to "Custom Script" section Under Custom Script section, Set "Allow users to run custom script on personal site" and "Allow users to run custom script on self-service created sites" options.  Click on "OK&
SharePoint Online: Enable SharePoint Designer using PowerShell SharePoint Online: Enable SharePoint Designer using PowerShell Reviewed by Salaudeen Rajack on September 16, 2018 Rating: 5

Co-Authoring Feature in SharePoint Online

September 15, 2018    
Overview of Co-authoring in SharePoint Online What is Co-Authoring in SharePoint Online? Well, Co-Authoring feature in SharePoint Online and OneDrive allows multiple users to edit documents and collaborate concurrently in real time. By default, documents in SharePoint Online document libraries are enabled with co-authoring. When multiple users edit one document (Word, Excel, PowerPoint, etc.) simultaneously other user's changes will be reflecting to everyone! In simple words, when everyone is working at the same time, that's called co-authoring. Prerequisites: Co-authoring feature doesn't work when you enable “Require check out” option or when you explicitly check out a document! It works on Office Online and in locally installed client applications with modern Office documents (.docx (Word), .pptx (PowerPoint), and .xlsx (Excel).) Also, all co-authors must have edit permissions and connected online. How to Co-Author Office Documents in SharePoint Online? Co-authorin
Co-Authoring Feature in SharePoint Online Co-Authoring Feature in SharePoint Online Reviewed by Salaudeen Rajack on September 15, 2018 Rating: 5

SharePoint Online: Unique Permissions Report using PowerShell

September 14, 2018    , , , , ,
Requirement: Get unique permissions report in SharePoint Online using PowerShell PowerShell for SharePoint Online Unique Permissions Report Here is the SharePoint Online PowerShell to get unique permissions: #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #To call a non-generic Load Method Function Invoke-LoadMethod() { Param( [Microsoft.SharePoint.Client.ClientObject]$Object = $(throw "Please provide a Client Object"), [string]$PropertyName ) $Ctx = $Object.Context $Load = [Microsoft.SharePoint.Client.ClientContext].GetMethod("Load") $Type = $Object.GetType() $ClientLoad = $Load.MakeGenericMethod($Type) $Parameter = [System.Linq.Expressions.Expressio
SharePoint Online: Unique Permissions Report using PowerShell SharePoint Online: Unique Permissions Report using PowerShell Reviewed by Salaudeen Rajack on September 14, 2018 Rating: 5

SharePoint Online: Set List Item Permissions using SharePoint Designer Workflow and REST API

September 10, 2018    , , ,
Business Requirement: In "Project Documents" SharePoint Online document library, Project related documents are getting uploaded by the project team. This library has "Permissions" drop-down column (metadata) with values "Restricted" and "Non-Restricted". If the Permission is restricted, we need to break the permissions of the document, remove all users and groups from it and add "Project Teams" SharePoint group to it. If its "Non-Restricted", then the document should inherit permissions from its parent library. Challenge: Unfortunately, we don't have any permissions related workflow actions available in SharePoint designer workflows! We don't have any 3rd party workflow products available in the tenant (Nintex is my choice!) Solution: Use SharePoint Designer Workflow "Call HTTP Web Service" action and REST APIs to set up permissions on the document. Prerequisite: Please note, You must activate "
SharePoint Online: Set List Item Permissions using SharePoint Designer Workflow and REST API SharePoint Online: Set List Item Permissions using SharePoint Designer Workflow and REST API Reviewed by Salaudeen Rajack on September 10, 2018 Rating: 5

SharePoint Online: Site Collection Permissions Report using PowerShell

September 06, 2018    , , , ,
Requirement: Generate permissions report for a SharePoint Online site collection. SharePoint Online: Site Collection Permissions Report using PowerShell Have you ever wanted to get SharePoint Online Site and subsites permissions using PowerShell? Well, This PowerShell script generates permission report on all objects which has unique permissions on the given site collection. It scans through following securables: Site collection administrators group Given site collection and sub-sites with unique permissions All lists and libraries with unique permissions All list items (and folders) with unique permissions. Here is the SharePoint Online PowerShell to get site permissions report: #sharepoint online powershell permissions report Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.Sha
SharePoint Online: Site Collection Permissions Report using PowerShell SharePoint Online: Site Collection Permissions Report using PowerShell Reviewed by Salaudeen Rajack on September 06, 2018 Rating: 5

SharePoint Online: PowerShell EnsureUser Method

September 04, 2018    , , ,
What is "EnsureUser" method in SharePoint Online? As its names suggests, ensure user method in SharePoint Online checks if the given user account is valid and then adds the user object to "User Information List". You may also use this method to obtain User object from given user name. Here is an example PowerShell script for SharePoint Online EnsureUser method: #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll" Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll" #Function to check if a user account is valid Function Ensure-SPOUser() { Param( [Parameter(Mandatory=$true)] [string]$UserID, [Parameter(Mandatory=$true)] [string]$SiteURL ) Try { #Setup Credentials to connect $Cred = Get-Credential #Se
SharePoint Online: PowerShell EnsureUser Method SharePoint Online: PowerShell EnsureUser Method Reviewed by Salaudeen Rajack on September 04, 2018 Rating: 5

SharePoint Online: Permission Report for Specific User in a Site Collection using PowerShell

September 04, 2018    , , , ,
Requirement:   Generate a permission report to audit a specific user's permissions in given SharePoint Online site collection, sub-sites, all its lists, libraries and list items. How to Check User Permissions in SharePoint Online? To get user permissions in SharePoint Online, Navigate to the SharePoint Online site on which you want to check permissions. Click on Settings Gear >> Site Settings >> Click on "Site Permissions" link. On the Site permissions page, under Permissions tab, click "Check Permissions" icon in the top ribbon. In the User/Group field, Enter the User Name which you want to verify permissions, and click on "Check Now" button In a moment, You will see list of permissions the user has on a site. But the problem is: This method of checking user permissions shows access to one site at a time. You should repeat these steps in each site, if you want to check user access for a site collection. So lets use PowerShell
SharePoint Online: Permission Report for Specific User in a Site Collection using PowerShell SharePoint Online: Permission Report for Specific User in a Site Collection using PowerShell Reviewed by Salaudeen Rajack on September 04, 2018 Rating: 5

How to Configure Hub Sites in SharePoint Online: Step by Step

September 01, 2018    ,
What is Hub Site in SharePoint Online? Hub sites in SharePoint Online is a new way to organize related sites together into centralized portals based on organizational attributes such as project, concepts, team, department, division, region, etc. A hub site can have both modern team sites and communication sites associated under it. Hub sites provide common navigational structure, look and feel, Logo and search across associated sites. Features of Hub Sites Hub site brings consistency across sites from the top to down. When a team site or communication site is associated to a hub site, it inherits common characteristics, such as: Consistent look and feel - All sites associated, gets the branding from hub site. Logo and theme of the hub site pushed to all underlying sites. This allows you to maintain a consistent look and feel across your sites.  Common Global Navigation across all associated sites Scoped Search - If you search within the hub site, It searches for content
How to Configure Hub Sites in SharePoint Online: Step by Step How to Configure Hub Sites in SharePoint Online: Step by Step Reviewed by Salaudeen Rajack on September 01, 2018 Rating: 5
Powered by Blogger.