
In conclusion, using PowerShell to create a folder in OneDrive for Business can be a useful tool for automating the process and streamlining. Write-host "Error: $($_.Exception.Message)" -foregroundcolor Red Write-host "`tError: $($_.Exception.Message)" -foregroundcolor Red $NewFolder = Resolve-PnPFolder -SiteRelativePath "Documents/$FolderName" -ErrorAction Stop #ensure folder in SharePoint Online using powershell Write-host -f Yellow "Ensuring Folder '$FolderName' in $($Site.URL)" -NoNewlineĬonnect-PnPOnline -Url $Site.URL -Credential $Cred -ErrorAction Stop $OneDriveSites = Get-PnPTenantSite -IncludeOneDriveSites -Filter "Url -like '/personal/'" This cmdlet creates a new folder if it doesn’t exist already.Ĭonnect-PnPOnline -Url $AdminCenterURL -Credential $Cred

To create a folder in the user’s OneDrive, we can use the Resolve-PnPFolder cmdlet. PnP PowerShell to Create Folder in OneDrive for Business Also, make sure you have the SharePoint Online PowerShell module (or CSOM SDK) installed. Please note that you will need to have Permission on the OneDrive site to run these commands. Write-host -f Red "Error:" $_.Exception.Message Write-host "Folder '$FolderName' Created Successfully!" -ForegroundColor Green #onedrive for business powershell create folder Write-host "Folder Exists Already!" -ForegroundColor Yellow $FolderNames = $Folders | Select -ExpandProperty Name $Ctx.Credentials = New-Object ($Cred.UserName,$Cred.Password)

Just navigate to the OneDrive folder in Windows Explorer > Right-click on the white space and choose “New Folder”.Īdd-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\"Īdd-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\.dll"

To create a new folder in OneDrive for Business site, do the following:

This article will show you how to create a new folder in OneDrive for Business. If you are using OneDrive for Business, you may want to create a separate folder to keep your files organized and easy to find. OneDrive is a cloud-based storage service provided by Microsoft that allows individuals and teams to store, share and collaborate on files from anywhere. How to create a Folder in OneDrive for Business? Requirement: Create a folder in OneDrive for Business site.
