Vue normale

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

Download Image from SharePoint Image column using JSON formatting

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.

You can add one image per SharePoint list item using SharePoint image column and the images are stored in Site Assets library by default. Using SharePoint online out of the box capabilities, there is no way to download the images from SharePoint list image column. In this blog, I will demonstrate how to create add a button within a SharePoint Online/Microsoft Lists modern experience view which downloads the image from SharePoint image column.

You can use below JSON to add a button in SharePoint online list column to download the image from image column in same list. This JSON formatting can be applied to any existing column in your SharePoint online list OR if you want to create a new column and then apply JSON formatting, follow the steps given in this blog: Working with SharePoint Online/Microsoft List Comments using JSON Formatting 

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"style": {
"border-radius": "5px",
"margin": "5px 0px",
"padding": "0px",
"border": "none",
"display": "=if([$Image.serverRelativeUrl]=='','none','')"
},
"attributes": {
"class": "ms-bgColor-themePrimary"
},
"children": [
{
"elmType": "a",
"style": {
"text-decoration": "none",
"padding": "12px 0px",
"width": "100%"
},
"attributes": {
"href": "=@currentWeb+'/_layouts/15/download.aspx?sourceurl='+if([$Image.serverRelativeUrl],[$Image.serverRelativeUrl],@currentWeb+'/Lists/**YOUR-LIST-NAME**/Attachments/'+[$ID]+'/'+[$Image.fileName])",
"target": "_blank",
"class": "ms-fontColor-white ms-fontSize-m"
},
"children": [
{
"elmType": "span",
"style": {
"display": "inline-block",
"padding": "0 4px"
},
"attributes": {
"iconName": "Download"
}
},
{
"elmType": "span",
"txtContent": "Download"
}
]
}
]
}

Where [$Image] is the internal name of your SharePoint image column. Also, make sure to edit the above JSON and replace the **YOUR-LIST-NAME** placeholder with your list’s name, as it appears in the list URL (including special characters).

This SharePoint JSON formatting code adds a button within a SharePoint Online/Microsoft Lists modern experience view which downloads the image from SharePoint image column:

Download Image from SharePoint Online Modern experience Image column using JSON formatting
Download Image from SharePoint Image column using JSON formatting

Above JSON is also available on GitHub in PnP List Formatting Repository at: Download Image from SharePoint Image column.

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

❌
❌