SharePoint Online: Create Picture Library using PowerShell

Requirement: Create a Picture Library in SharePoint Online using PowerShell.

How to add a picture library in SharePoint Online?

As the name implies, Picture Library in SharePoint Online is optimized for storing and sharing digital images. Picture library lets you upload and store photos and images that can be used on your site or shared with others. This article will show you how to create a picture library in SharePoint Online. We will also show you how to create a Picture Library in SharePoint Online using PowerShell.

To create a picture library in SharePoint Online, follow these steps:

  1. Navigate to the SharePoint site where you want to create the picture library.
  2. Click on Settings gear icon >> Select Add an app. (You can also go to “Site contents”, and then click add an app.)
  3. On the Apps page, scroll down and select the “Picture Library” icon. You can use the search box as well.
  4. In the New dialog box, type a name for the library and click Create.
    sharepoint online create picture library

Once the picture library is created, you can upload pictures by clicking on “Upload” in the library’s toolbar and selecting the pictures you want to add.

PowerShell to Create Picture Library in SharePoint Online

Here is how to create a picture library in SharePoint Online with 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"

#Variables for Processing
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"
$LibraryName = "Logos"
$LibraryDescription ="Library to store all Logos of the Company"

#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 Web
    $Web = $Ctx.Web
    $Ctx.Load($Web)
    $Ctx.ExecuteQuery()

    #Define List Creation Parameters
    $ListCreationInformation = New-Object Microsoft.SharePoint.Client.ListCreationInformation 
    $ListCreationInformation.Title = $LibraryName 
    $ListCreationInformation.TemplateType = [int][Microsoft.SharePoint.Client.ListTemplatetype]::PictureLibrary
    #Create Picture Library
    $List = $Web.Lists.Add($ListCreationInformation)
    $List.Description = $LibraryDescription
    $Ctx.ExecuteQuery()
    Write-host -f Green "Picture Library '$LibraryName' Created Successfully!"
}
Catch {
    write-host -f Red "Error:" $_.Exception.Message
}

To get all list template types, refer: https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server/ee541191(v%3Doffice.15)

Add Picture Library in SharePoint Online using PnP PowerShell

To create a picture library in SharePoint Online, use this PnP PowerShell script:

#Parameters
$SiteURL = "https://crescent.sharepoint.com/teams/Ops"
$LibraryName = "Team Outing"
 
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Interactive
 
#powershell to create picture library
New-PnPList -Title $LibraryName -Template PictureLibrary

In summary, creating a picture library in SharePoint Online is a simple process that can help you store and manage your pictures in an organized and efficient way. By following the steps outlined above, you can create a new picture library, upload pictures, and customize the library settings to meet your needs. You can also automate this process and create picture libraries in Sharepoint Online using PowerShell.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “SharePoint Online: Create Picture Library using PowerShell

  • I would like to know this as well.

    Reply
  • Our version does not show picture library as an option. How do I add that in so I can create a picture library?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *