This blog will create a folder in document library in SharePoint Online using Powershell Cmdlts.
Creating folder in a SharePoint document library gives you an efficient way to group and manage your content, such as grouping reports by fiscal year or department.
Create Folder in SharePoint 2013 Online UI method.
- Navigate to the SharePoint site containing the SharePoint library where you want to add the folder.
- Click the name of the library on the Quick Launch bar, or click Settings , and click Site contents, and then click the title of the library you want to add folders to.
Steps
- 1.Open SharePoint Management Shell.
- 2.Copy the below Code and paste it.
- 3.Run the Code.
- ##########################
-
- #Script: Below Script will create a new Folder in Office 365 SharePoint Online
- #Author: Gowtham Rajamanickam
- #Date :16-03-2017
-
- #########################
-
- #Before Run the Scritp you must load the Client Assembly files
-
- 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 createFolder{
-
- param ($SiteUrl, $ListURL, $FolderName, $UserName ,$Password)
-
- #Connect Office 365 SharePoint Online Site
- $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force))
-
- $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
- $Context.Credentials = $credentials
-
- #Get the List Root Folder
- $ParentFolder=$Context.web.GetFolderByServerRelativeUrl($ListName)
-
- #Create New Folder
- $Folder = $ParentFolder.Folders.Add($FolderName)
- $ParentFolder.Context.Load($Folder)
- $ParentFolder.Context.ExecuteQuery()
-
- Write-host "New Folder Created Successfully!"
- }
-
- createFolder "https://gowthamr.sharepoint.com/" "Documents" "TutorialFolder" "[email protected]" "Enter your Password here"
Was my Blog helpful? Was it missing content? If so, please let us know what's confusing or missing at the bottom of this page.
Thanks for reading my blogs.