Vue normale

Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.
À partir d’avant-hierFlux principal

Update SharePoint Page Banner Image using PnP PowerShell

Using pages in SharePoint is a great way to share information or any news/announcement in your organization to SharePoint site users. SharePoint site pages can be improved by utilizing banner images in the page title area. Adding banner images to the page title area not only makes the page more visually appealing but also helps to convey the page’s purpose to the user more quickly and effectively.

In this blog post, we will see how to change the SharePoint Page Banner Image using PnP PowerShell.

First of all upload a high quality image in one of the document libraries in your SharePoint site. SharePoint site page banner images in title area look best when they are landscape or 16:9 or greater in aspect ratio, and when they are at least 1 MB in size. Check this Microsoft official documentation for recommended specifications for banner images: Image sizing and scaling in SharePoint modern pages

Then you can use below PnP PowerShell script to update the banner image at the top of the SharePoint online modern page:


# SharePoint online site URL
$siteUrl = "https://contoso.sharepoint.com/sites/wlive"	

# Connect to SharePoint online site  
Connect-PnPOnline -Url $siteUrl -Interactive

# Update SharePoint site page banner image
Set-PnPPage -Identity "Open-Door-Policy" -HeaderType Custom -ServerRelativeImageUrl "/sites/wlive/SiteAssets/work-remotely.jpeg"

Once you run above script successfully, you will find that banner image for your SharePoint site page is updated successfully:

Update SharePoint online modern page banner image in page title area using PnP PowerShell
Update SharePoint Page Banner Image using PnP PowerShell

Learn more

Change SharePoint Online List URL using PnP PowerShell

When you create a new list in SharePoint Online site, the list URL is automatically generated based on the name you provide while list creation. SharePoint uses a process called URL encoding to ensure that the URL is valid and does not contain any special characters that could cause problems.

URL encoding replaces special characters in the list name with a percent sign (%) followed by a code that represents the character. For example, if you create a list called My List & Tasks, SharePoint will encode the ampersand (&) as %26 and white space as %20 in the list URL. The resulting list URL will be something like:

https://<site-address>/Lists/My%20List%20%26%20Tasks/AllItems.aspx

There could be several reasons why you might want to change the SharePoint list URL after the list has been created. For example, removing special characters & their encoding (%26 or %20) from URL or changing it with short URL or to enhance the accessibility and usability of the list, by making it easier to remember or share with others. Whatever the reason, changing the SharePoint list URL should be done with caution, and only after careful consideration of the potential impact on the users and the overall system.

You can use below PnP PowerShell script to change SharePoint online list URL and rename the list after list creation:

# SharePoint online site URL
$siteUrl = "https://contoso.sharepoint.com/sites/SPConnect"

# Current display name of SharePoint list
$oldListName = "Images List"

# New list URL
$newListUrl = "Lists/LogoUniverse"

# New display name for SharePoint list
$newListName = "Logo Universe"

# Connect to SharePoint online site
Connect-PnPOnline -Url $siteUrl -Interactive

# Get the SharePoint list
$list = Get-PnPList -Identity $oldListName

# Move SharePoint list to the new URL
$list.Rootfolder.MoveTo($newListUrl)
Invoke-PnPQuery

# Rename List
Set-PnPList -Identity $oldListName -Title $newListName

Once you run above script successfully, you can navigate to SharePoint list using new URL:

Change SharePoint Online List URL using PnP PowerShell
Change SharePoint Online List URL using PnP PowerShell

Note: Changing the SharePoint list URL may have implications for any workflows, alerts, links referring to the list, or customizations that are associated with the list. So, it is recommended to test the changes in a non-production environment before implementing them in a live environment.

Learn more

change-sharepoint-online-list-url-using-pnp-powershell

ganeshsanapblogs

Change SharePoint Online List URL using PnP PowerShell

Update SharePoint Page Banner Image using PnP PowerShell

Using pages in SharePoint is a great way to share information or any news/announcement in your organization to SharePoint site users. SharePoint site pages can be improved by utilizing banner images in the page title area. Adding banner images to the page title area not only makes the page more visually appealing but also helps to convey the page’s purpose to the user more quickly and effectively.

In this blog post, we will see how to change the SharePoint Page Banner Image using PnP PowerShell.

First of all upload a high quality image in one of the document libraries in your SharePoint site. SharePoint site page banner images in title area look best when they are landscape or 16:9 or greater in aspect ratio, and when they are at least 1 MB in size. Check this Microsoft official documentation for recommended specifications for banner images: Image sizing and scaling in SharePoint modern pages

Then you can use below PnP PowerShell script to update the banner image at the top of the SharePoint online modern page:


# SharePoint online site URL
$siteUrl = "https://contoso.sharepoint.com/sites/wlive"	

# Connect to SharePoint online site  
Connect-PnPOnline -Url $siteUrl -Interactive

# Update SharePoint site page banner image
Set-PnPPage -Identity "Open-Door-Policy" -HeaderType Custom -ServerRelativeImageUrl "/sites/wlive/SiteAssets/work-remotely.jpeg"

Once you run above script successfully, you will find that banner image for your SharePoint site page is updated successfully:

Update SharePoint online modern page banner image in page title area using PnP PowerShell
Update SharePoint Page Banner Image using PnP PowerShell

Learn more

update-sharepoint-page-banner-image-using-pnp-powershell

ganeshsanapblogs

Update SharePoint online modern page banner image in page title area using PnP PowerShell

Add/Update image columns in SharePoint/Microsoft Lists using PnP PowerShell

In my previous blog about image columns in SharePoint, I explained all you need to know about New Image column type in SharePoint online including how to create an image column, how to add image to a list item, where the Images will be stored, etc.

In this blog, I will explain how to create a new list item with image column and update existing list item to update the image column using PnP PowerShell.

Create new list item with Image column

You can use Add-PnPListItem command in PnP PowerShell to create a new item in SharePoint list with Image column:

# Connect to SharePoint online site
Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/spconnect -Interactive

# Get UniqueId of file you're referencing (without this part your image won't appear in Power Apps (browser or mobile app) or Microsoft Lists (iOS app))
$imageFileUniqueId = (Get-PnPFile -Url "SiteAssets/Lists/dbc6f551-252b-462f-8002-c8f88d0d12d5/PnP-PowerShell-Blue.png" -AsListItem)["UniqueId"]

# Create new list item with image column
Add-PnPListItem -List "Logo Universe" -Values @{"Title" = "PnP PowerShell"; "Image" = "{'type':'thumbnail','fileName':'PnP-PowerShell-Blue.png','fieldName':'Image','serverUrl':'https://contoso.sharepoint.com','serverRelativeUrl':'/sites/SPConnect/SiteAssets/Lists/dbc6f551-252b-462f-8002-c8f88d0d12d5/PnP-PowerShell-Blue.png', 'id':'$($imageFileUniqueId)'}"}
Create a new SharePoint list item with Image column in SharePoint online using PnP PowerShell
Create new list item with Image column

Update SharePoint list item with Image column

You can use Set-PnPListItem cmdlet in PnP PowerShell to update existing SharePoint list item with Image column:

# Connect to SharePoint online site
Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/spconnect -Interactive

# Get UniqueId of file you're referencing (without this part your image won't appear in Power Apps (browser or mobile app) or Microsoft Lists (iOS app))
$imageFileUniqueId = (Get-PnPFile -Url "SiteAssets/Lists/dbc6f551-252b-462f-8002-c8f88d0d12d5/PnP-PowerShell-Green.png" -AsListItem)["UniqueId"]

# Update SharePoint list item with image column
Set-PnPListItem -List "Logo Universe" -Identity 12 -Values @{"Image" = "{'type':'thumbnail','fileName':'PnP-PowerShell-Blue.png','fieldName':'Image','serverUrl':'https://contoso.sharepoint.com','serverRelativeUrl':'/sites/SPConnect/SiteAssets/Lists/dbc6f551-252b-462f-8002-c8f88d0d12d5/PnP-PowerShell-Green.png', 'id':'$($imageFileUniqueId)'}"}
Update SharePoint list item with Image column in SharePoint online using PnP PowerShell
Update SharePoint list item with Image column

Note: This blog post is updated based on the updates to PnP script sample at Add/Update Image in SharePoint Image column so that added/updated images will work in Power Apps or Microsoft Lists mobile app.

Learn more

❌
❌