Vue normale

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

How to Hide a SharePoint List or Library from the UI?

SharePoint provides powerful collaboration features to users including lists and libraries, and while transparency is crucial, there are instances where hiding a list or library becomes essential for optimizing user experiences and/or maintaining data integrity. Example: Power Apps often relies on SharePoint lists as data sources. However, not all lists are meant for end users to view directly. By hiding lists or libraries from SharePoint UI, you can prevent end users from editing the data directly from SharePoint lists.

In this blog post, we’ll explore how to hide a SharePoint list or document library using PnP PowerShell & CLI for Microsoft 365 and view all hidden lists/libraries in SharePoint site using PnP PowerShell & CLI for Microsoft 365.

Hiding a SharePoint List or Library using PnP PowerShell

You can use below PnP PowerShell script to hide a SharePoint online list or document library from SharePoint UI (Site Contents page):

# SharePoint Online site URL
$siteUrl = Read-Host -Prompt "Enter your SharePoint online site URL (e.g https://contoso.sharepoint.com/sites/work)"

# Display name of SharePoint online list or document library
$listName = Read-Host -Prompt "Enter the display name of your SharePoint list or library (e.g My List)"

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

# Hide SharePoint online list from UI
Set-PnPList -Identity $listName -Hidden $true

# Disconnect SharePoint online connection
Disconnect-PnPOnline

Hide a SharePoint List or Library using CLI for Microsoft 365

Use below CLI for Microsoft 365 script to hide a SharePoint list or document library from SharePoint UI:

# SharePoint Online site URL
$siteUrl = Read-Host -Prompt "Enter your SharePoint online site URL (e.g https://contoso.sharepoint.com/sites/work)"

# Display name of SharePoint online list or document library
$listName = Read-Host -Prompt "Enter the display name of your SharePoint list or library (e.g My List)"

# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
m365 login
}

# Hide SharePoint online list or library from UI (Site Contents)
m365 spo list set --webUrl $siteUrl --title $listName --hidden true

# Disconnect SharePoint online connection
m365 logout

View hidden lists/libraries in SharePoint site using PnP PowerShell

You can use below PnP PowerShell script to view all hidden lists and libraries in the given SharePoint site:

# SharePoint Online site URL
$siteUrl = Read-Host -Prompt "Enter your SharePoint online site URL (e.g https://contoso.sharepoint.com/sites/work)"

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

# View all hidden lists/libraries in a SharePoint online site
Get-PnPList | Where-Object {$_.Hidden -eq $true}

# Disconnect SharePoint online connection
Disconnect-PnPOnline

View hidden lists/libraries in SharePoint site using CLI for Microsoft 365

Use below CLI for Microsoft 365 script to view all hidden lists and document libraries in the given SharePoint online site:

# SharePoint Online site URL
$siteUrl = Read-Host -Prompt "Enter your SharePoint online site URL (e.g https://contoso.sharepoint.com/sites/work)"

# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
m365 login
}

# Hide SharePoint online list or library from UI (Site Contents)
m365 spo list list --webUrl $siteUrl --properties "Id,Title,Url" --filter "Hidden eq true" | ConvertFrom-Json

# Disconnect SharePoint online connection
m365 logout

Learn more

How to find the Internal name of columns in SharePoint Online?

The internal name of a SharePoint column is a unique name that is automatically generated by SharePoint when a column is created. It is used by SharePoint internally to reference and retrieve the value of a particular column associated with an item or document. The internal name is generated based on the display name you provide but all special characters and spaces will be replaced with Unicode’s by SharePoint. Internal name is generated only once while creating a new column and it cannot be changed even if you change the display name of SharePoint column.

The internal name is not visible to users in the SharePoint user interface by default, but it is commonly used in various scenarios, such as in SharePoint REST APIs, Power Automate flow expressions, Power Apps formulas, PowerShell, etc. to interact with column data programmatically.

Where are Internal names of SharePoint columns used?

  1. Custom Scripts: When creating custom scripts, such as JavaScript or PowerShell, the internal names of columns are required to reference and manipulate the values of the columns while interacting with SharePoint data.
  2. Workflows: In SharePoint Designer workflows or Microsoft Power Automate (formerly known as Microsoft Flow), the internal names of columns are used to reference the values of the columns as inputs or outputs in the workflow actions and in expressions.
  3. Custom Solutions: When building custom solutions, such as SharePoint apps, SharePoint framework (SPFx) web parts, or custom code, the internal names of columns are required to interact with the columns programmatically.
  4. Power Apps: Few of the Power Apps functions like ShowColumns, SortByColumns, etc. requires using internal names of SharePoint columns in formula.
  5. JSON Formatting: Internal name of SharePoint column is required in JSON formatting to reference the column value with [$InternalNameOfColumn] syntax.

How to find the Internal name of a SharePoint column?

Using Modern experience list view

You can use sorting or filtering options from SharePoint online modern experience list view to find the internal name of a SharePoint column. Sort by and Filter by options are supported by most of the column types in SharePoint like Single line of text, Choice, Number, Date and Time, Yes/No (Boolean), Person or Group (single selection), etc.

For this afticle, we will use sorting based on SharePoint choice column as an example:

1. Go to the SharePoint online list for which you want to check the internal name of a column.

2. Click on column name/header from the list view and select either Ascending (A to Z) or Descending (Z to A) option from the popup menu:

Find internal name of SharePoint column by sorting choice column from SharePoint online modern experience list view
Find internal name of SharePoint column by sorting choice column

3. SharePoint will sort the list view based on selection and the browser URL will be changed like:

https://contoso.sharepoint.com/sites/wlive/Lists/InternalNames/AllItems.aspx?sortField=ChoiceColumn&isAscending=false

Where column name (ChoiceColumn) after sortField= is the internal name of your SharePoint choice column.

4. Similarly, when you use Filter by option in SharePoint modern experience to filter the list view based on Date and Time column (named as Start Date), SharePoint changes browser URL like:

https://contoso.sharepoint.com/sites/wlive/Lists/InternalNames/AllItems.aspx?FilterField1=Start_x0020_Date&FilterValue1=2023-04-05&FilterType1=DateTime

Where column name (Start_x0020_Date) after FilterField1= is the internal name of your SharePoint date and time column. Notice _x0020_ in internal column name which is an Unicode encoding of the space character in the display name of date and time column (Start Date).

Using Classic experience List settings page

Few of the SharePoint column types like Multiple lines of text, Hyperlink or Picture, Image, etc. does not support sorting or filtering from SharePoint modern experience list views. So, you have to use the classic experience list settings page to find the internal name for such SharePoint columns.

Follow below steps to find the internal name of multiple lines of text column using SharePoint classic experience list settings page:

1. Go to the SharePoint online list for which you want to check the internal name of a column.

2. Click on Settings (gear) icon from the top right corner and select List settings:

Open SharePoint online List settings page from modern experience list view to find the internal name of SharePoint column
Open SharePoint online list settings page

3. From list settings page, scroll down to the Columns section and click on the column name for which you want to find the internal name:

Open SharePoint online column settings page from classic experience list settings page to find the internal name of SharePoint column
Open SharePoint online Column settings page

4. SharePoint will open column settings page for the respective column with browser URL like:

https://contoso.sharepoint.com/sites/wlive/_layouts/15/FldEdit.aspx?List=%7B6FBA7FAE-AFC0-45D6-99EE-0AB20629EE41%7D&Field=MultilineTextCol
SharePoint online column settings page showing internal name of column
SharePoint online column settings page showing internal name of column

Where column name (MultilineTextCol) after Field= is the internal name of your SharePoint online multiple lines of text column.

Note: You can use this classic experience method to find out the internal name of SharePoint columns for all column types.

Using SharePoint REST API

You can use SharePoint REST API endpoint like below to get the internal name of SharePoint column based on it’s display name. Open URL in below format directly from browser tab:

https://contoso.sharepoint.com/sites/SPConnect/_api/web/lists/getbytitle('InternalNames')/fields?$select=Title,InternalName&$filter=Title eq 'Multiline Text Column'
Find internal name of SharePoint online list column using SharePoint REST API
Find internal name of SharePoint column using SharePoint REST API
Using PnP PowerShell

You can use below PnP PowerShell script to find the internal name of SharePoint online list column using PnP PowerShell:

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

# Display name of SharePoint list
$listName = "InternalNames"

# Display name of SharePoint list column
$columnName = "Multiline Text Column"
 
# Connect to SharePoint online site
Connect-PnPOnline -Url $siteUrl -Interactive
 
# Get internal name of SharePoint list column
Get-PnPField -Identity $columnName -List $listName | Select Title,InternalName
Find internal name of SharePoint online list column using PnP PowerShell
Find internal name of SharePoint column using PnP PowerShell
Using CLI for Microsoft 365

You can use below CLI for Microsoft 365 script to find the internal name of SharePoint online list column using CLI for Microsoft 365:

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

# Display name of SharePoint list
$listName = "InternalNames"

# Display name of SharePoint list column
$columnName = "Multiline Text Column"
 
# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
	m365 login
}

# Get internal name of SharePoint list column
m365 spo field get --webUrl $siteUrl --listTitle $listName --title $columnName --output text
Find internal name of SharePoint online list column using CLI for Microsoft 365
Find internal name of SharePoint column using CLI for Microsoft 365

Best practices for naming SharePoint columns

When creating columns in SharePoint, it’s important to follow best practices for column naming to avoid using special characters or Unicode characters in internal names. Here are some recommended best practices:

  1. Use only alphanumeric characters: Stick to using letters (A-Z, a-z) and numbers (0-9) in column names. Avoid using special characters such as @, #, $, %, _, etc. Avoid column names beginning with numbers.
  2. Avoid spaces: Use PascalCase to separate words in column names instead of spaces. For example, use ColumnName instead of Column Name. This can help prevent issues with URLs, Unicode encoding, and referencing column names in scripts or code.
  3. Avoid reserved words: SharePoint has reserved words that are used for system functionality, and using them in column names may cause conflicts. Examples of reserved words include “ID”, “Modified”, “Created”, “Title”, etc. Avoid using these reserved words as column names.
  4. Keep it concise and meaningful: Use descriptive and meaningful names for columns that clearly indicate their purpose. Avoid using vague or generic names that may be confusing or ambiguous to users. Use column description to provide more information about the columns.
  5. Be consistent: Establish a consistent naming convention for columns across your SharePoint site or site collection to ensure uniformity and ease of management. This can also help with documentation, training, and maintenance of your SharePoint environment.

I hope you liked this article. Give your valuable feedback & suggestions in the comments section below and share this article with others.

Learn more

Board view in SharePoint online / Microsoft Lists

Microsoft is introducing a new Board view feature in SharePoint online/Microsoft Lists. This Kanban like Board view allow users to work with list items in a board with swimlanes that represent their current progress. This view is ideal when users want to track items as they move forward in a process or workflow.

  • The board view in lists will allow users to drag & drop items through the stages of process or workflow.
  • Users will be able to configure which columns from the list are displayed in the cards and in what order.

This feature will roll out both on desktop and web. Currently Microsoft Planner also allows creating Kanban boards using content-rich tasks.

This feature is associated with Microsoft 365 Roadmap ID: 85634.

Release Timeline

Microsoft will begin rolling out board view feature in mid-January and expects to complete the rollout in late February (previously early February).

How this will affect your organization

After the feature rollout, you will see the Board as an option during creation of new views for a SharePoint online list / Microsoft Lists. Additionally, there will be a dropdown to choose a column to organize the board by. Presently, the board can be organized by any Choice or Boolean column that exists in the list.

Kanban Board view in SharePoint online/Microsoft Lists modern experience
Kanban Board view in SharePoint online/Microsoft Lists

What you need to do to prepare

No action is required to enable this feature. You may consider notifying users about this new capability and update your training and documentation as appropriate.

Unscheduled Pane in Microsoft Lists Calendar Views

Last year, Microsoft released the Calendar view feature for SharePoint Online and Microsoft lists for modern experience and later added support for using calendar views in List web parts on modern pages. This was working all great, but list items were not appearing in the calendar view when the start and/or end dates were not entered for the list items.

Now Microsoft is introducing this new feature, Unscheduled Pane, which will allow users to review all the list items not yet appearing in the calendar view due to missing dates. These items will appear on the Unscheduled tab within the events pane to the right of the Calendar view.

This feature is associated with Microsoft 365 Roadmap ID: 93223.

Release Timeline

Microsoft began rolling this out in mid-April 2022 and expected to complete the rollout by late April 2022 – Rollout completed.

How this will affect your organization

You will now see a new Unscheduled tab within the events pane to the right of the Calendar view. The items with missing start and/or end dates and those with start date later than the end date would appear on this pane. You may select the items to open the edit form and make appropriate edits or you can drag and drop the items on calendar view to schedule these items.

Microsoft Lists and SharePoint online Unscheduled pane in calendar view in modern experience
Unscheduled Pane in Microsoft Lists Calendar Views

What you need to do to prepare

No action is required to enable this feature. But you may consider notifying users about this new capability and update your training and documentation as appropriate.

Learn more

Microsoft Lists: Calendar view item drag and drop

Microsoft recently introduced Unscheduled Pane for calendar views in SharePoint Online and Microsoft lists in modern experience. Users will see the list items with missing start and/or end dates and those with start date later than the end date on this unscheduled pane.

Now Microsoft is introducing item drag and drop feature for calendar views which will allow users to easily reorganize list items in a calendar view. Users will be able to reschedule items by dragging and dropping them from one day to another day in a Calendar view, or by pulling an item from the Unscheduled pane that appears on the right, within Calendar view.

This message is associated with Microsoft 365 Roadmap ID: 93285.

Release Timeline

Microsoft began rolling this out in mid-May 2022 and expected to complete the rollout by late May 2022 – Rollout completed.

How this will affect your organization

After rollout of this item drag and drop feature, users will be able to:

  • Reschedule list items by dragging them from one date to another date in the calendar view canvas
  • Un-schedule items (remove the saved dates) by dragging from calendar canvas and dropping them in the Unscheduled pane
  • Schedule items by dragging them from the Unscheduled pane and dropping them on any date in calendar view canvas
Microsoft Lists and SharePoint online Calendar view item drag and drop in modern experience
Microsoft Lists: Calendar view item drag and drop

What you need to do to prepare

No action is required to enable this feature. You may consider notifying users about this new capability and update your training and documentation as appropriate.

Learn more

Easily Create Power BI Reports from SharePoint Online/Microsoft Lists

Microsoft is announcing a feature which will provide a new guided authoring experience in SharePoint Online/Microsoft Lists that will make it easy to quickly create business intelligence reports in Power BI using your list schema and data.

Using this feature you can visualize your list in Power BI. This is a new view and author experience that auto-generates an initial report for you based on the information in your list. You can specify fields to create from, or update the visuals shown in the report.

If you want more advanced report authoring capabilities, you can move into Edit mode and further refine. To create a report from a list, click the Integrate menu, choose Power BI and then you will see “Visualize the list”.

Key points

  • Microsoft 365 Roadmap ID 72175 and 93221
  • Timing:
    • Targeted Release: rolling out in early May – Completed
    • Standard Release: rolling out from early June (previously late May) to mid-July (previously early June) – Completed
    • Government: Microsoft will begin rolling out in mid-June (previously early May) and expect to complete by late June (previously early June).
  • Roll-out: tenant level
  • Control type: admin control
  • Action: review and assess

How this will affect your organization

List users will see a new menu option in Integrate Power BI > Visualize this list, which allows users to create a new Power BI report using that list.

With just one click, you’ll be able to autogenerate a basic report and customize the list columns that are shown in the report. To take further advantage of Power BI’s advanced data visualization capabilities, just go into Edit mode. Once a report is saved and published, it will appear in the same submenu under Integrate> Power BI.

Easily Create Power BI Reports from SharePoint Online/Microsoft Lists
Easily Create Power BI Reports from SharePoint Online/Microsoft Lists
Auto-generated initial report from SharePoint online list in Power BI
Auto-generated initial report in Power BI
Notes
  • Users with a Microsoft 365 E5 license or Power BI Pro license will have access to the full report authoring and viewing experience.
  • Users without either of the above licenses will be prompted by Power BI to sign up for a 60-day free trial of Power BI Pro when they attempt to save a new report or edit/view an existing report. To turn off self-service sign-up so that the option for a trial is not exposed to List users, click here.
  • Users with a Power BI free license may only visualize their list data, but cannot publish or view reports.

What you need to do to prepare

This feature is ON by default, but can be turned off from the Power BI Admin Portal under Tenant settings.

If this feature is disabled for tenants, users will continue to see the Power BI submenu in the List command bar, but any attempt to create or view a report will result in an error page.

Note

Certain complex column types in Lists such as Person, Location, Rich Text, Multi-select Choice, and Image are not currently supported when the Power BI report is autogenerated.

Learn more

Custom list templates in SharePoint Online/Microsoft Lists

This new feature will support the addition of custom list templates from your organization alongside the ready-made templates Microsoft provides to make it easy to get started tracking and managing information.

Today, we have several ready-made List templates designed to make it easy to get started tracking and managing information – like events, issues, and requests. Now, Microsoft will be supporting custom list templates – the ability for organizations to define custom list templates. Note, you will be able to manage which templates are available to which people, based on their job role.

Key points

  • Microsoft 365 Roadmap ID: 70753
  • Timing:
    • Targeted release (entire organization): will roll out in mid-July and complete by mid-August 2021 – Complete
    • Standard release: will roll out in mid-September 2022 (previously mid-May) and be complete by early November (previously mid-June)
  • Roll-out: tenant level
  • Control type: user control / admin control
  • Action: review, assess and educate

How this will affect your organization

This feature will give organizations the ability to create their own custom list templates with custom formatting and schema. It will also empower organizations to create repeatable solutions within the same Microsoft Lists infrastructure (including list creation in SharePoint, Teams, and within the Lists app itself).

End-user impact

Visual updates to the list creation dialog and the addition of a From your organization tab when creating a new list. This new tab is where your custom list templates appear alongside the ready-made templates from Microsoft.

Custom list templates in SharePoint online/Microsoft Lists modern experience
Custom list templates in SharePoint online/Microsoft Lists
Admin impact

Custom list templates can only be uploaded by a SharePoint administrator for Microsoft 365 by using PowerShell cmdlets. For consistency, the process of defining and uploading custom list templates is like the custom site templates experience.

To define and upload custom list templates, admins will use the following site template PowerShell cmdlets:

The visual updates for this feature will be seen by end-users in the updated user interface (UI) when creating a list.

The From your organization tab will be empty until your organization defines and publishes custom list templates.

From your organization tab in custom list templates wizard in SharePoint online/Microsoft Lists
From your organization tab in custom list templates wizard

What you need to do to prepare

You might want to notify your users about this new capability and update your training and documentation as appropriate.

Learn more

SharePoint JSON Formatting: Remove column name from group header

SharePoint’s JSON formatting capabilities empower users to customize the look and feel of SharePoint lists and libraries effortlessly. One common customization request is to remove the column name from the group header in a grouped SharePoint list view. In this blog post, we’ll explore why you might want to remove the column name and provide a step-by-step guide on achieving this using SharePoint JSON formatting.

Why Remove the Column Name?

When organizing data in SharePoint lists, you may find that the default group headers display the column names. While this is useful in many scenarios, there are times when you might prefer a cleaner, more streamlined view. Removing the column name from the grouped header can help reduce visual clutter and focus on the column value for each group.

How to Remove Column Name from Group Header?

Follow below steps to remove the column name from group header in SharePoint online or Microsoft Lists’ list view:

1. First, navigate to the SharePoint list for which you want to apply the JSON formatting. Click on the “Switch view options” drop down from top right corner of the list and select the view where you want to remove the column name from the group header.

2. Once in the desired list view, click on the “Switch view options” drop down again and select the “Format current view” option, which opens the list formatting pane.

3. Within the list formatting pane, locate the “Advanced mode” option and click on it to access the JSON formatting editor. Here you can modify the JSON to achieve the desired customization.

4. To remove the column name from the group header, copy below JSON and paste it in the JSON formatting editor:

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"groupProps": {
"headerFormatter": {
"elmType": "div",
"style": {
"padding-left": "12px",
"font-size": "16px",
"font-weight": "400",
"cursor": "pointer",
"outline": "0px",
"white-space": "nowrap",
"text-overflow": "ellipsis"
},
"customRowAction": {
"action": "defaultClick"
},
"children": [
{
"elmType": "div",
"children": [
{
"elmType": "span",
"style": {
"padding": "5px 5px 5px 5px"
},
"txtContent": "@group.fieldData.displayValue"
}
]
},
{
"elmType": "div",
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-direction": "row",
"justify-content": "center"
},
"children": [
{
"elmType": "div",
"txtContent": "=' (' + @group.count + ')'"
}
]
}
]
}
]
}
}
}

5. Click on the “Save” button within the JSON list formatting pane to apply the changes.

Once saved, the SharePoint list view will reflect the updated formatting, with the column name effectively removed from the group header.

Note

If you have applied the “Group by” on Person or Group (people field) OR Lookup column, [object object] will appear in the group header after applying above JSON. In that case, you will have to modify above JSON slightly as per the following table:

Type of grouped columnPart of the JSON to be changedChange to
Person or Group@group.fieldData.displayValue@group.fieldData.title
Lookup@group.fieldData.displayValue@group.fieldData.lookupValue

Also, if you have grouped your SharePoint list view based on two columns (for example: person or group and single line of text column), you can change the text to show (txtContent) based on display name of column like:

"txtContent": "=if(@group.columnDisplayName == 'Assigned To', @group.fieldData.title, @group.fieldData.displayValue)"

By following these steps, you can harness the power of SharePoint’s JSON formatting capabilities to achieve a cleaner and more tailored presentation of your grouped list view data.

I hope this guide has been helpful in demonstrating how to remove the column name from the group header in a SharePoint list view using JSON formatting.

Above JSON is also available on GitHub in PnP List Formatting Repository at: Remove column name from group header

Learn more

Disable Quick property editing (Grid view) from SharePoint Online list

SharePoint Online and Microsoft Lists offers a multitude of features to enhance collaboration and streamline data management. One such feature is the Quick Property Editing (Edit in Grid view), which allows users to bulk edit metadata for multiple list items directly from the list view. While this feature can improve efficiency, there are scenarios where disabling it becomes necessary. In this blog post, we’ll explore various methods to achieve this in SharePoint Online.

From SharePoint UI

Follow below steps to disable quick edit (Edit in grid view) from SharePoint list UI:

1. Go to your SharePoint Online list.

2. Click on Settings (gear icon) from the top right corner and select List settings.

3. Click on Advanced settings link from List settings page.

4. From Advanced settings page, scroll down and set Quick property editing (Allow items in this list to be edited using Quick Edit and the Details Pane?) to No.

5. Click OK button at the bottom of advanced list settings page.

Using PnP PowerShell

You can use below PnP PowerShell script to disable Quick property editing (Grid view) from SharePoint Online list or document library:

# Display name of SharePoint online list or document library
$listName = "My SharePoint List"

# SharePoint online site URL
$siteUrl = Read-Host -Prompt "Enter your SharePoint site URL (e.g https://contoso.sharepoint.com/sites/pnppowershell)"

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

# Disable Quick property editing (Grid view) from SharePoint list
Set-PnPList -Identity $listName -DisableGridEditing $true

Write-Host "Done! :-)" -ForegroundColor Green

# Disconnect SharePoint online connection
Disconnect-PnPOnline

You can set -DisableGridEditing to $false to enable the quick edit (edit in grid view) back to your SharePoint list.

Using CLI for Microsoft 365

Use below CLI for Microsoft 365 script to disable Quick property editing (Edit in grid view) from SharePoint Online or Microsoft Lists:

# Display name of SharePoint online list or document library
$listName = "My SharePoint List"

# SharePoint online site URL
$siteUrl = Read-Host -Prompt "Enter your SharePoint site URL (e.g https://contoso.sharepoint.com/sites/cliformicrosoft365)"

# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
m365 login
}

# Disable Quick property editing (Grid view) from SharePoint list
m365 spo list set --webUrl $siteUrl --title $listName --disableGridEditing true

Write-Host "Done! :-)" -ForegroundColor Green

# Disconnect SharePoint online connection
m365 logout

You can set --disableGridEditing to false to enable the quick property editing (edit in grid view) for your SharePoint online list.

Learn more

SharePoint Online: All you need to know about New Image column type

Microsoft introduced a new Image column type to SharePoint Online lists and libraries. Using this column, list and library users will be able to add a single image file from their computer to an item in a list or a library.

History & Roadmap

  • Microsoft announced Image column first time via admin message center on July 31, 2020 (Message Center ID: MC219652).
  • When it was added to Microsoft 365 roadmap, it was expected to complete the rollout of image column to all by mid-August 2020.
  • On August 19, 2020, Microsoft delayed the rollout of this feature & updated the announcement stating, “To ensure the best possible experience for our users, we are delaying some of our deployments to reduce the amount of change flowing into the services.”
  • Finally, Image column feature released to all SharePoint Online tenants in October 2020 release, Roadmap.

Creating an Image Column

Follow below steps to create an image column in a SharePoint Online list:

  1. Go to SharePoint Online list where you want to create an image column.
  2. Click on Add column in list view and select Image. If you are not able to see the Image column option, then click on More…
  3. Name your column and make sure type is selected as Image.
  4. You can specify additional column settings as per your requirements and then click OK
Creating an Image column in SharePoint Online list
Creating an Image Column

When you create an Image column, it will be shown as a Thumbnail column in Columns section under list settings:

Columns in List settings in SharePoint Online
Columns section under list settings

Adding Image to list items

When you create a new item in list, Image column will be shown like below on list form. When you click on Add an image, you will be able to add a single image file from your computer to an item.

New Image column on list form in SharePoint Online
List form with image column

After you select an image from computer, the file name will be shown in the form. If you want to replace the image, you can click on Edit icon.

Image column on New item list form in SharePoint Online
List form after image is selected

Display in list view

Once you Save the list form, Image column will show the thumbnail of selected image in list view. If you want to see the image in full size, you need to click on image thumbnail in list view.

New Image column in SharePoint Online list view in modern experience
Images in list view

Where the Images will be stored?

After adding images to your SharePoint list items, you must be wondering about where these images will be stored in your SharePoint Online site.

Image columns in SharePoint online stores the images by default in a sub folder inside Site Assets library which has format in general like Site Assets –> Lists –> <GUID of list>

Images from Image columns stored in SharePoint Online Site Assets library
Images stored in Site Assets library

Update: With the recent updates to SharePoint Online and Microsoft Lists, if the attachments option is enabled in your list, images will be stored in same SharePoint list and general format for image location will be like below as mentioned in the article, Download Image from SharePoint Image column using JSON formatting:

https://contoso.sharepoint.com/sites/MySite/Lists/MyList/Attachments/[ID]/[ImageFileName]

I hope you liked this blog. Give your valuable feedback & suggestions in the comments section below and share this blog with others.

See also

SharePoint Online: Display Country Flags using JSON Formatting – multiple selections

SharePoint Online JSON formatting is a powerful tool that allows users to customize the display of list data, bringing a new level of functionality and aesthetics to SharePoint online lists. In my previous blog post, we saw how to show country flags using SharePoint JSON formatting for single selection choice column.

The JSON formatting sample given in this blog post demonstrates displaying flags of the counties selected in the multiple selection SharePoint choice column.

The country flags are shown using the FlagCDN – CDN & API of flags web site API. As Microsoft have blocked the external domain images in SharePoint JSON formatting by default, you will have to allow the flagcdn.com domain in HTML Field Security settings of your SharePoint site by following this step by step guide: Why external domain image URLs are not working in SharePoint Online JSON Formatting?

Also, You can find the list of countries used in this JSON sample at: List of Countries.

Multiple selection choice column settings

Add list of countries in the choice column settings like:

Multiple selection SharePoint choice column settings

SharePoint Online JSON sample

Use below JSON to apply JSON column formatting for multiple selection SharePoint choice column to show the flag of selected countries:

{
	"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
	"elmType": "div",
	"inlineEditField": "[$Countries]",
	"children": [
		{
			"elmType": "div",
			"style": {
				"display": "flex",
				"flex-direction": "column",
				"justify-content": "flex-start",
				"flex-wrap": "wrap",
				"margin": "5px 0px"
			},
			"children": [
				{
					"elmType": "div",
					"forEach": "choiceIterator in @currentField",
					"style": {
						"margin": "3px 0px",
						"display": "flex",
						"flex-direction": "row",
						"align-items": "center"
					},
					"children": [
						{
							"elmType": "img",
							"attributes": {
								"src": "=if([$choiceIterator],'https://flagcdn.com/w550/' + if([$choiceIterator]=='Afghanistan','af',if([$choiceIterator]=='Albania','al',if([$choiceIterator]=='Algeria','dz',if([$choiceIterator]=='American Samoa','as',if([$choiceIterator]=='Andorra','ad',if([$choiceIterator]=='Angola','ao',if([$choiceIterator]=='Anguilla','ai',if([$choiceIterator]=='Antarctica','aq',if([$choiceIterator]=='Antigua and Barbuda','ag',if([$choiceIterator]=='Argentina','ar',if([$choiceIterator]=='Armenia','am',if([$choiceIterator]=='Aruba','aw',if([$choiceIterator]=='Australia','au',if([$choiceIterator]=='Austria','at',if([$choiceIterator]=='Azerbaijan','az',if([$choiceIterator]=='Bahamas','bs',if([$choiceIterator]=='Bahrain','bh',if([$choiceIterator]=='Bangladesh','bd',if([$choiceIterator]=='Barbados','bb',if([$choiceIterator]=='Belarus','by',if([$choiceIterator]=='Belgium','be',if([$choiceIterator]=='Belize','bz',if([$choiceIterator]=='Benin','bj',if([$choiceIterator]=='Bermuda','bm',if([$choiceIterator]=='Bhutan','bt',if([$choiceIterator]=='Bolivia','bo',if([$choiceIterator]=='Bonaire','bq',if([$choiceIterator]=='Bosnia and Herzegovina','ba',if([$choiceIterator]=='Botswana','bw',if([$choiceIterator]=='Bouvet Island','bv',if([$choiceIterator]=='Brazil','br',if([$choiceIterator]=='British Indian Ocean Territory','io',if([$choiceIterator]=='Brunei','bn',if([$choiceIterator]=='Bulgaria','bg',if([$choiceIterator]=='Burkina Faso','bf',if([$choiceIterator]=='Burundi','bi',if([$choiceIterator]=='Cambodia','kh',if([$choiceIterator]=='Cameroon','cm',if([$choiceIterator]=='Canada','ca',if([$choiceIterator]=='Cape Verde','cv',if([$choiceIterator]=='Cayman Islands','ky',if([$choiceIterator]=='Central African Republic','cf',if([$choiceIterator]=='Chad','td',if([$choiceIterator]=='Chile','cl',if([$choiceIterator]=='China','cn',if([$choiceIterator]=='Christmas Island','cx',if([$choiceIterator]=='Cocos (Keeling) Islands','cc',if([$choiceIterator]=='Colombia','co',if([$choiceIterator]=='Comoros','km',if([$choiceIterator]=='Democratic Republic of the Congo','cd',if([$choiceIterator]=='Cook Islands','ck',if([$choiceIterator]=='Costa Rica','cr',if([$choiceIterator]=='Croatia','hr',if([$choiceIterator]=='Cuba','cu',if([$choiceIterator]=='Cyprus','cy',if([$choiceIterator]=='Czech Republic','cz',if([$choiceIterator]=='Denmark','dk',if([$choiceIterator]=='Djibouti','dj',if([$choiceIterator]=='Dominica','dm',if([$choiceIterator]=='Dominican Republic','do',if([$choiceIterator]=='Ecuador','ec',if([$choiceIterator]=='Egypt','eg',if([$choiceIterator]=='El Salvador','sv',if([$choiceIterator]=='Equatorial Guinea','gq',if([$choiceIterator]=='Eritrea','er',if([$choiceIterator]=='Estonia','ee',if([$choiceIterator]=='Ethiopia','et',if([$choiceIterator]=='Falkland Islands (Malvinas)','fk',if([$choiceIterator]=='Faroe Islands','fo',if([$choiceIterator]=='Fiji','fj',if([$choiceIterator]=='Finland','fi',if([$choiceIterator]=='France','fr',if([$choiceIterator]=='French Guiana','gf',if([$choiceIterator]=='French Polynesia','pf',if([$choiceIterator]=='French Southern Territories','tf',if([$choiceIterator]=='Gabon','ga',if([$choiceIterator]=='Gambia','gm',if([$choiceIterator]=='Georgia','ge',if([$choiceIterator]=='Germany','de',if([$choiceIterator]=='Ghana','gh',if([$choiceIterator]=='Gibraltar','gi',if([$choiceIterator]=='Greece','gr',if([$choiceIterator]=='Greenland','gl',if([$choiceIterator]=='Grenada','gd',if([$choiceIterator]=='Guadeloupe','gp',if([$choiceIterator]=='Guam','gu',if([$choiceIterator]=='Guatemala','gt',if([$choiceIterator]=='Guernsey','gg',if([$choiceIterator]=='Guinea','gn',if([$choiceIterator]=='Guinea-Bissau','gw',if([$choiceIterator]=='Guyana','gy',if([$choiceIterator]=='Haiti','ht',if([$choiceIterator]=='Heard Island and McDonald Islands','hm',if([$choiceIterator]=='Honduras','hn',if([$choiceIterator]=='Hong Kong','hk',if([$choiceIterator]=='Hungary','hu',if([$choiceIterator]=='Iceland','is',if([$choiceIterator]=='India','in',if([$choiceIterator]=='Indonesia','id',if([$choiceIterator]=='Iran','ir',if([$choiceIterator]=='Iraq','iq',if([$choiceIterator]=='Ireland','ie',if([$choiceIterator]=='Isle of Man','im',if([$choiceIterator]=='Israel','il',if([$choiceIterator]=='Italy','it',if([$choiceIterator]=='Jamaica','jm',if([$choiceIterator]=='Japan','jp',if([$choiceIterator]=='Jersey','je',if([$choiceIterator]=='Jordan','jo',if([$choiceIterator]=='Kazakhstan','kz',if([$choiceIterator]=='Kenya','ke',if([$choiceIterator]=='Kiribati','ki',if([$choiceIterator]=='North Korea','kp',if([$choiceIterator]=='South Korea','kr',if([$choiceIterator]=='Kuwait','kw',if([$choiceIterator]=='Kyrgyzstan','kg',if([$choiceIterator]=='Laos','la',if([$choiceIterator]=='Latvia','lv',if([$choiceIterator]=='Lebanon','lb',if([$choiceIterator]=='Lesotho','ls',if([$choiceIterator]=='Liberia','lr',if([$choiceIterator]=='Libya','ly',if([$choiceIterator]=='Liechtenstein','li',if([$choiceIterator]=='Lithuania','lt',if([$choiceIterator]=='Luxembourg','lu',if([$choiceIterator]=='Macao','mo',if([$choiceIterator]=='North Macedonia','mk',if([$choiceIterator]=='Madagascar','mg',if([$choiceIterator]=='Malawi','mw',if([$choiceIterator]=='Malaysia','my',if([$choiceIterator]=='Maldives','mv',if([$choiceIterator]=='Mali','ml',if([$choiceIterator]=='Malta','mt',if([$choiceIterator]=='Marshall Islands','mh',if([$choiceIterator]=='Martinique','mq',if([$choiceIterator]=='Mauritania','mr',if([$choiceIterator]=='Mauritius','mu',if([$choiceIterator]=='Mayotte','yt',if([$choiceIterator]=='Mexico','mx',if([$choiceIterator]=='Micronesia','fm',if([$choiceIterator]=='Moldova','md',if([$choiceIterator]=='Monaco','mc',if([$choiceIterator]=='Mongolia','mn',if([$choiceIterator]=='Montenegro','me',if([$choiceIterator]=='Montserrat','ms',if([$choiceIterator]=='Morocco','ma',if([$choiceIterator]=='Mozambique','mz',if([$choiceIterator]=='Myanmar','mm',if([$choiceIterator]=='Namibia','na',if([$choiceIterator]=='Nauru','nr',if([$choiceIterator]=='Nepal','np',if([$choiceIterator]=='Netherlands','nl',if([$choiceIterator]=='New Caledonia','nc',if([$choiceIterator]=='New Zealand','nz',if([$choiceIterator]=='Nicaragua','ni',if([$choiceIterator]=='Niger','ne',if([$choiceIterator]=='Nigeria','ng',if([$choiceIterator]=='Niue','nu',if([$choiceIterator]=='Norfolk Island','nf',if([$choiceIterator]=='Northern Mariana Islands','mp',if([$choiceIterator]=='Norway','no',if([$choiceIterator]=='Oman','om',if([$choiceIterator]=='Pakistan','pk',if([$choiceIterator]=='Palau','pw',if([$choiceIterator]=='Palestine','ps',if([$choiceIterator]=='Panama','pa',if([$choiceIterator]=='Papua New Guinea','pg',if([$choiceIterator]=='Paraguay','py',if([$choiceIterator]=='Peru','pe',if([$choiceIterator]=='Philippines','ph',if([$choiceIterator]=='Pitcairn','pn',if([$choiceIterator]=='Poland','pl',if([$choiceIterator]=='Portugal','pt',if([$choiceIterator]=='Puerto Rico','pr',if([$choiceIterator]=='Qatar','qa',if([$choiceIterator]=='Romania','ro',if([$choiceIterator]=='Russia','ru',if([$choiceIterator]=='Rwanda','rw',if([$choiceIterator]=='Saint Barthélemy','bl',if([$choiceIterator]=='Saint Helena, Ascension and Tristan da Cunha','sh',if([$choiceIterator]=='Saint Kitts and Nevis','kn',if([$choiceIterator]=='Saint Lucia','lc',if([$choiceIterator]=='Saint Martin','mf',if([$choiceIterator]=='Saint Pierre and Miquelon','pm',if([$choiceIterator]=='Saint Vincent and the Grenadines','vc',if([$choiceIterator]=='Samoa','ws',if([$choiceIterator]=='San Marino','sm',if([$choiceIterator]=='Sao Tome and Principe','st',if([$choiceIterator]=='Saudi Arabia','sa',if([$choiceIterator]=='Senegal','sn',if([$choiceIterator]=='Serbia','rs',if([$choiceIterator]=='Seychelles','sc',if([$choiceIterator]=='Sierra Leone','sl',if([$choiceIterator]=='Singapore','sg',if([$choiceIterator]=='Sint Maarten','sx',if([$choiceIterator]=='Slovakia','sk',if([$choiceIterator]=='Slovenia','si',if([$choiceIterator]=='Solomon Islands','sb',if([$choiceIterator]=='Somalia','so',if([$choiceIterator]=='South Africa','za',if([$choiceIterator]=='South Georgia and the South Sandwich Islands','gs',if([$choiceIterator]=='South Sudan','ss',if([$choiceIterator]=='Spain','es',if([$choiceIterator]=='Sri Lanka','lk',if([$choiceIterator]=='Sudan','sd',if([$choiceIterator]=='Suriname','sr',if([$choiceIterator]=='Svalbard and Jan Mayen','sj',if([$choiceIterator]=='Swaziland','sz',if([$choiceIterator]=='Sweden','se',if([$choiceIterator]=='Switzerland','ch',if([$choiceIterator]=='Syria','sy',if([$choiceIterator]=='Taiwan','tw',if([$choiceIterator]=='Tajikistan','tj',if([$choiceIterator]=='Tanzania','tz',if([$choiceIterator]=='Thailand','th',if([$choiceIterator]=='Timor-Leste','tl',if([$choiceIterator]=='Togo','tg',if([$choiceIterator]=='Tokelau','tk',if([$choiceIterator]=='Tonga','to',if([$choiceIterator]=='Trinidad and Tobago','tt',if([$choiceIterator]=='Tunisia','tn',if([$choiceIterator]=='Turkey','tr',if([$choiceIterator]=='Turkmenistan','tm',if([$choiceIterator]=='Turks and Caicos Islands','tc',if([$choiceIterator]=='Tuvalu','tv',if([$choiceIterator]=='Uganda','ug',if([$choiceIterator]=='Ukraine','ua',if([$choiceIterator]=='United Arab Emirates','ae',if([$choiceIterator]=='United Kingdom','gb',if([$choiceIterator]=='United States','us',if([$choiceIterator]=='United States Minor Outlying Islands','um',if([$choiceIterator]=='Uruguay','uy',if([$choiceIterator]=='Uzbekistan','uz',if([$choiceIterator]=='Vanuatu','vu',if([$choiceIterator]=='Vatican City','va',if([$choiceIterator]=='Venezuela','ve',if([$choiceIterator]=='Viet Nam','vn',if([$choiceIterator]=='British Virgin Islands','vg',if([$choiceIterator]=='United States Virgin Islands','vi',if([$choiceIterator]=='Wallis and Futuna','wf',if([$choiceIterator]=='Western Sahara','eh',if([$choiceIterator]=='Yemen','ye',if([$choiceIterator]=='Zambia','zm',if([$choiceIterator]=='Zimbabwe','zw','')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + '.png','')",
								"title": ""
							},
							"style": {
								"max-width": "50px",
								"padding": "0 10px 0 0"
							}
						},
						{
							"elmType": "span",
							"txtContent": "[$choiceIterator]"
						}
					]
				}
			]
		}
	]
}

Where [$Countries] is the internal name of SharePoint choice column. You can get the internal name of your SharePoint list column by following this article: How to find the Internal name of columns in SharePoint Online?

Output

Multiple selection SharePoint choice column showing country flags using SharePoint online JSON formatting
Displaying country flags using SharePoint JSON formatting

Learn more

SharePoint Online: Display Country Flags using JSON Formatting

SharePoint Online JSON formatting is a powerful tool that allows users to customize the display of list data, bringing a new level of functionality and aesthetics to SharePoint online lists. In this blog post, we’ll explore an exciting and educational application of JSON formatting for displaying country flags within SharePoint lists.

The JSON formatting sample given in this blog post demonstrates displaying flags of the counties selected in the single selection SharePoint choice column.

The country flags are shown using the FlagCDN – CDN & API of flags web site API. As Microsoft have blocked the external domain images in SharePoint JSON formatting by default, you will have to allow the flagcdn.com domain in HTML Field Security settings of your SharePoint site by following this step by step guide: Why external domain image URLs are not working in SharePoint Online JSON Formatting?

Also, You can find the list of countries used in this JSON sample at: List of Countries.

Single selection choice column settings

Add list of countries in the choice column settings like:

Single selection SharePoint choice column settings to display country flags using SharePoint online JSON formatting
Single selection SharePoint choice column settings

SharePoint Online JSON sample

Use below JSON to apply JSON column formatting for single selection SharePoint choice column to show the flag of selected country:

{
	"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
	"elmType": "div",
	"inlineEditField": "[$Country]",
	"children": [
		{
			"elmType": "img",
			"attributes": {
				"src": "=if(@currentField,'https://flagcdn.com/w550/' + if(@currentField=='Afghanistan','af',if(@currentField=='Albania','al',if(@currentField=='Algeria','dz',if(@currentField=='American Samoa','as',if(@currentField=='Andorra','ad',if(@currentField=='Angola','ao',if(@currentField=='Anguilla','ai',if(@currentField=='Antarctica','aq',if(@currentField=='Antigua and Barbuda','ag',if(@currentField=='Argentina','ar',if(@currentField=='Armenia','am',if(@currentField=='Aruba','aw',if(@currentField=='Australia','au',if(@currentField=='Austria','at',if(@currentField=='Azerbaijan','az',if(@currentField=='Bahamas','bs',if(@currentField=='Bahrain','bh',if(@currentField=='Bangladesh','bd',if(@currentField=='Barbados','bb',if(@currentField=='Belarus','by',if(@currentField=='Belgium','be',if(@currentField=='Belize','bz',if(@currentField=='Benin','bj',if(@currentField=='Bermuda','bm',if(@currentField=='Bhutan','bt',if(@currentField=='Bolivia','bo',if(@currentField=='Bonaire','bq',if(@currentField=='Bosnia and Herzegovina','ba',if(@currentField=='Botswana','bw',if(@currentField=='Bouvet Island','bv',if(@currentField=='Brazil','br',if(@currentField=='British Indian Ocean Territory','io',if(@currentField=='Brunei','bn',if(@currentField=='Bulgaria','bg',if(@currentField=='Burkina Faso','bf',if(@currentField=='Burundi','bi',if(@currentField=='Cambodia','kh',if(@currentField=='Cameroon','cm',if(@currentField=='Canada','ca',if(@currentField=='Cape Verde','cv',if(@currentField=='Cayman Islands','ky',if(@currentField=='Central African Republic','cf',if(@currentField=='Chad','td',if(@currentField=='Chile','cl',if(@currentField=='China','cn',if(@currentField=='Christmas Island','cx',if(@currentField=='Cocos (Keeling) Islands','cc',if(@currentField=='Colombia','co',if(@currentField=='Comoros','km',if(@currentField=='Democratic Republic of the Congo','cd',if(@currentField=='Cook Islands','ck',if(@currentField=='Costa Rica','cr',if(@currentField=='Croatia','hr',if(@currentField=='Cuba','cu',if(@currentField=='Cyprus','cy',if(@currentField=='Czech Republic','cz',if(@currentField=='Denmark','dk',if(@currentField=='Djibouti','dj',if(@currentField=='Dominica','dm',if(@currentField=='Dominican Republic','do',if(@currentField=='Ecuador','ec',if(@currentField=='Egypt','eg',if(@currentField=='El Salvador','sv',if(@currentField=='Equatorial Guinea','gq',if(@currentField=='Eritrea','er',if(@currentField=='Estonia','ee',if(@currentField=='Ethiopia','et',if(@currentField=='Falkland Islands (Malvinas)','fk',if(@currentField=='Faroe Islands','fo',if(@currentField=='Fiji','fj',if(@currentField=='Finland','fi',if(@currentField=='France','fr',if(@currentField=='French Guiana','gf',if(@currentField=='French Polynesia','pf',if(@currentField=='French Southern Territories','tf',if(@currentField=='Gabon','ga',if(@currentField=='Gambia','gm',if(@currentField=='Georgia','ge',if(@currentField=='Germany','de',if(@currentField=='Ghana','gh',if(@currentField=='Gibraltar','gi',if(@currentField=='Greece','gr',if(@currentField=='Greenland','gl',if(@currentField=='Grenada','gd',if(@currentField=='Guadeloupe','gp',if(@currentField=='Guam','gu',if(@currentField=='Guatemala','gt',if(@currentField=='Guernsey','gg',if(@currentField=='Guinea','gn',if(@currentField=='Guinea-Bissau','gw',if(@currentField=='Guyana','gy',if(@currentField=='Haiti','ht',if(@currentField=='Heard Island and McDonald Islands','hm',if(@currentField=='Honduras','hn',if(@currentField=='Hong Kong','hk',if(@currentField=='Hungary','hu',if(@currentField=='Iceland','is',if(@currentField=='India','in',if(@currentField=='Indonesia','id',if(@currentField=='Iran','ir',if(@currentField=='Iraq','iq',if(@currentField=='Ireland','ie',if(@currentField=='Isle of Man','im',if(@currentField=='Israel','il',if(@currentField=='Italy','it',if(@currentField=='Jamaica','jm',if(@currentField=='Japan','jp',if(@currentField=='Jersey','je',if(@currentField=='Jordan','jo',if(@currentField=='Kazakhstan','kz',if(@currentField=='Kenya','ke',if(@currentField=='Kiribati','ki',if(@currentField=='North Korea','kp',if(@currentField=='South Korea','kr',if(@currentField=='Kuwait','kw',if(@currentField=='Kyrgyzstan','kg',if(@currentField=='Laos','la',if(@currentField=='Latvia','lv',if(@currentField=='Lebanon','lb',if(@currentField=='Lesotho','ls',if(@currentField=='Liberia','lr',if(@currentField=='Libya','ly',if(@currentField=='Liechtenstein','li',if(@currentField=='Lithuania','lt',if(@currentField=='Luxembourg','lu',if(@currentField=='Macao','mo',if(@currentField=='North Macedonia','mk',if(@currentField=='Madagascar','mg',if(@currentField=='Malawi','mw',if(@currentField=='Malaysia','my',if(@currentField=='Maldives','mv',if(@currentField=='Mali','ml',if(@currentField=='Malta','mt',if(@currentField=='Marshall Islands','mh',if(@currentField=='Martinique','mq',if(@currentField=='Mauritania','mr',if(@currentField=='Mauritius','mu',if(@currentField=='Mayotte','yt',if(@currentField=='Mexico','mx',if(@currentField=='Micronesia','fm',if(@currentField=='Moldova','md',if(@currentField=='Monaco','mc',if(@currentField=='Mongolia','mn',if(@currentField=='Montenegro','me',if(@currentField=='Montserrat','ms',if(@currentField=='Morocco','ma',if(@currentField=='Mozambique','mz',if(@currentField=='Myanmar','mm',if(@currentField=='Namibia','na',if(@currentField=='Nauru','nr',if(@currentField=='Nepal','np',if(@currentField=='Netherlands','nl',if(@currentField=='New Caledonia','nc',if(@currentField=='New Zealand','nz',if(@currentField=='Nicaragua','ni',if(@currentField=='Niger','ne',if(@currentField=='Nigeria','ng',if(@currentField=='Niue','nu',if(@currentField=='Norfolk Island','nf',if(@currentField=='Northern Mariana Islands','mp',if(@currentField=='Norway','no',if(@currentField=='Oman','om',if(@currentField=='Pakistan','pk',if(@currentField=='Palau','pw',if(@currentField=='Palestine','ps',if(@currentField=='Panama','pa',if(@currentField=='Papua New Guinea','pg',if(@currentField=='Paraguay','py',if(@currentField=='Peru','pe',if(@currentField=='Philippines','ph',if(@currentField=='Pitcairn','pn',if(@currentField=='Poland','pl',if(@currentField=='Portugal','pt',if(@currentField=='Puerto Rico','pr',if(@currentField=='Qatar','qa',if(@currentField=='Romania','ro',if(@currentField=='Russia','ru',if(@currentField=='Rwanda','rw',if(@currentField=='Saint Barthélemy','bl',if(@currentField=='Saint Helena, Ascension and Tristan da Cunha','sh',if(@currentField=='Saint Kitts and Nevis','kn',if(@currentField=='Saint Lucia','lc',if(@currentField=='Saint Martin','mf',if(@currentField=='Saint Pierre and Miquelon','pm',if(@currentField=='Saint Vincent and the Grenadines','vc',if(@currentField=='Samoa','ws',if(@currentField=='San Marino','sm',if(@currentField=='Sao Tome and Principe','st',if(@currentField=='Saudi Arabia','sa',if(@currentField=='Senegal','sn',if(@currentField=='Serbia','rs',if(@currentField=='Seychelles','sc',if(@currentField=='Sierra Leone','sl',if(@currentField=='Singapore','sg',if(@currentField=='Sint Maarten','sx',if(@currentField=='Slovakia','sk',if(@currentField=='Slovenia','si',if(@currentField=='Solomon Islands','sb',if(@currentField=='Somalia','so',if(@currentField=='South Africa','za',if(@currentField=='South Georgia and the South Sandwich Islands','gs',if(@currentField=='South Sudan','ss',if(@currentField=='Spain','es',if(@currentField=='Sri Lanka','lk',if(@currentField=='Sudan','sd',if(@currentField=='Suriname','sr',if(@currentField=='Svalbard and Jan Mayen','sj',if(@currentField=='Swaziland','sz',if(@currentField=='Sweden','se',if(@currentField=='Switzerland','ch',if(@currentField=='Syria','sy',if(@currentField=='Taiwan','tw',if(@currentField=='Tajikistan','tj',if(@currentField=='Tanzania','tz',if(@currentField=='Thailand','th',if(@currentField=='Timor-Leste','tl',if(@currentField=='Togo','tg',if(@currentField=='Tokelau','tk',if(@currentField=='Tonga','to',if(@currentField=='Trinidad and Tobago','tt',if(@currentField=='Tunisia','tn',if(@currentField=='Turkey','tr',if(@currentField=='Turkmenistan','tm',if(@currentField=='Turks and Caicos Islands','tc',if(@currentField=='Tuvalu','tv',if(@currentField=='Uganda','ug',if(@currentField=='Ukraine','ua',if(@currentField=='United Arab Emirates','ae',if(@currentField=='United Kingdom','gb',if(@currentField=='United States','us',if(@currentField=='United States Minor Outlying Islands','um',if(@currentField=='Uruguay','uy',if(@currentField=='Uzbekistan','uz',if(@currentField=='Vanuatu','vu',if(@currentField=='Vatican City','va',if(@currentField=='Venezuela','ve',if(@currentField=='Viet Nam','vn',if(@currentField=='British Virgin Islands','vg',if(@currentField=='United States Virgin Islands','vi',if(@currentField=='Wallis and Futuna','wf',if(@currentField=='Western Sahara','eh',if(@currentField=='Yemen','ye',if(@currentField=='Zambia','zm',if(@currentField=='Zimbabwe','zw','')))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) + '.png','')",
				"title": ""
			},
			"style": {
				"max-width": "50px",
				"padding": "0 10px 0 0"
			}
		},
		{
			"elmType": "span",
			"txtContent": "@currentField"
		}
	]
}

Where [$Country] is the internal name of SharePoint choice column. You can get the internal name of your SharePoint list column by following this article: How to find the Internal name of columns in SharePoint Online?

Output

Single selection SharePoint choice column showing country flags using SharePoint online JSON formatting
Displaying country flags using SharePoint JSON formatting

Learn more

SharePoint Online: External Image URLs not working in JSON Formatting

SharePoint Online is a powerful collaboration and content management platform that empowers organizations to create, manage, and share information seamlessly. JSON formatting in SharePoint online allows users to customize the look and feel of the columns, views and forms in their SharePoint lists and libraries.

Earlier this year Microsoft updated the SharePoint JSON formatting feature and blocked most of the external domain image sources by default in custom JSON column and view formatting.

Only images from the following domains are allowed by default:

  • tenant domain, configured multi-geo domains and vanity domains (company.sharepoint.com)
  • cdn.office.net, akamaihd.net, static2.sharepointonline.com CDNs

The Solution – Modifying HTML Field Security Settings:

To address the challenge of displaying external web site domain images in JSON formatting, one effective solution is to adjust the HTML field security settings of your SharePoint site. This involves whitelisting trusted external domains or CDNs to allow their images to be displayed within your SharePoint environment. Follow these steps to implement the solution:

1. Go to your SharePoint online site.

2. Click on Settings (gear) icon from top right corner and select Site information.

3. Click on View all site settings link from Site information panel, it will open the SharePoint site settings page.

4. Under the Site Collection Administration section, locate and click on the HTML Field Security settings link.

5. Select Allow contributors to insert iframes only from the following domains, add external web site domain from where you are using the images under Allow iframes from this domain text box and click Add button.

6. Click OK button at the bottom of HTML Field Security settings page to save the changes.

Allow external site domain from SharePoint HTML Field Security settings

7. Navigate back to the SharePoint list where you are using external image with JSON formatting and refresh the web page. Now, you should see that the external images are working using the SharePoint Online JSON formatting.

Output

Before adding external site domain to SharePoint HTML Field Security Settings:

External Image URLs are not working in SharePoint Online JSON formatting
External Image URLs are not working in SharePoint Online JSON formatting

After adding external site domain to SharePoint HTML Field Security Settings:

External Image URLs are working in SharePoint Online JSON formatting after adding external web site domain to SharePoint HTML Field Security settings
Working External Image URLs in SharePoint Online JSON formatting

Learn more

Enable or Disable the Return to Classic SharePoint link in SharePoint Online

SharePoint Online provides a modernized and responsive user interface that offers improved collaboration, customization, and integration capabilities. It provides a clean and intuitive design, responsive layouts, and enhanced mobile support. Modern SharePoint sites include modern lists and libraries, modern web parts, and modern pages.

On modern SharePoint list and library pages, there’s a link in the lower left of the page below quick launch (left navigation) that says Return to classic SharePoint. This link allows users who are working in the SharePoint modern experience to switch the current list or document library to classic experience. On the classic page, there’s a corresponding link that says Exit classic experience which reverts the current list or document library back to modern experience.

You may want to hide Return to classic SharePoint link from list and library pages to promote the adoption & utilization of the modern experience and have consistent modern user experience across the SharePoint site.

Luckily, as a tenant administrator you have control to show or hide these links from SharePoint online modern experience using one of the ways shown below:

Using SharePoint Online PowerShell

Use below SharePoint Online PowerShell script to enable or disable the Return to classic SharePoint and Exit classic experience links from SharePoint list and document library pages:

# SharePoint online admin center URL
$adminCenterUrl = "https://contoso-admin.sharepoint.com/"

# Connect to SharePoint online admin center
Connect-SPOService -Url $adminCenterUrl

# Enable Return to classic SharePoint and Exit classic experience links
Set-SPOTenant -DisableBackToClassic $false

# Disable Return to classic SharePoint and Exit classic experience links
Set-SPOTenant -DisableBackToClassic $true

Using PnP PowerShell

You can use below PnP PowerShell script to show or hide the “Return to classic SharePoint” and “Exit classic experience” links from SharePoint online modern experience list and document library pages:

# SharePoint online admin center URL
$adminCenterUrl = "https://contoso-admin.sharepoint.com/"

# Connect to SharePoint online admin center
Connect-PnPOnline -Url $adminCenterUrl -Interactive

# Show Return to classic SharePoint and Exit classic experience links
Set-PnPTenant -DisableBackToClassic $false

# Hide Return to classic SharePoint and Exit classic experience links
Set-PnPTenant -DisableBackToClassic $true

Conclusion

Enabling or disabling the “Return to Classic SharePoint” and “Exit classic experience” links in SharePoint Online can be accomplished using SharePoint Online PowerShell or PnP PowerShell scripts. By following the steps outlined in this blog post, you can manage the user experience and tailor it to your organization’s specific requirements. Whether you embrace the modern SharePoint experience or occasionally need access to classic features, these PowerShell scripts provide the flexibility to adapt SharePoint Online to your needs.

Learn more

Add/Update image columns in SharePoint lists using CLI for Microsoft 365

In my previous blog about image columns in SharePoint, I explained how to add or update image columns in SharePoint online lists or Microsoft Lists using PnP PowerShell and Power Automate.

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 CLI for Microsoft 365.

Create new list item with Image column

You can use below CLI for Microsoft 365 script to create a new item in SharePoint online list with Image column:

# SharePoint online site URL
$siteUrl = Read-Host -Prompt "Enter your site URL (e.g https://<tenant>.sharepoint.com/sites/contoso)"

# Server Relative URL of image file from same SharePoint site
$serverRelativeUrl = Read-Host -Prompt "Enter Server Relative URL of image file (e.g /sites/contoso/SiteAssets/Lists/dbc6f551-252b-462f-8002-c8f88d0d12d5/CLI-For-Microsoft-365-Blue.png)"

# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
    m365 login
}

# 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 = (m365 spo file get --webUrl $siteUrl --url $serverRelativeUrl | ConvertFrom-Json).UniqueId

# Create new list item with image column
m365 spo listitem add --listTitle "Logo Universe" --webUrl $siteUrl --Title "CLI for Microsoft 365" --Image "{'type':'thumbnail','fileName':'CLI-For-Microsoft-365-Blue.png','fieldName':'Image','serverUrl':'https://contoso.sharepoint.com','serverRelativeUrl':'$($serverRelativeUrl)', 'id':'$($imageFileUniqueId)'}"

# Disconnect SharePoint online connection
m365 logout
Create a new SharePoint list item with Image column in SharePoint online using CLI for Microsoft 365
Create new list item with Image column

Update SharePoint list item with Image column

You can use below CLI for Microsoft 365 script to update existing SharePoint list item with Image column:

# SharePoint online site URL
$siteUrl = Read-Host -Prompt "Enter your site URL (e.g https://<tenant>.sharepoint.com/sites/contoso)"

# Server Relative URL of image file from same SharePoint site
$serverRelativeUrl = Read-Host -Prompt "Enter Server Relative URL of image file (e.g /sites/contoso/SiteAssets/Lists/dbc6f551-252b-462f-8002-c8f88d0d12d5/CLI-For-Microsoft-365-Blue.png)"

# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
    m365 login
}

# 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 = (m365 spo file get --webUrl $siteUrl --url $serverRelativeUrl | ConvertFrom-Json).UniqueId

# Update list item with image column
m365 spo listitem set --listTitle "Logo Universe" --id 15 --webUrl $siteUrl --Image "{'type':'thumbnail','fileName':'CLI-For-Microsoft-365-Blue.png','fieldName':'Image','serverUrl':'https://contoso.sharepoint.com','serverRelativeUrl':'$($serverRelativeUrl)', 'id':'$($imageFileUniqueId)'}"

# Disconnect SharePoint online connection
m365 logout
Update SharePoint list item with Image column in SharePoint online using CLI for Microsoft 365
Update SharePoint list item with Image column

Learn more

Enable/Disable SharePoint Online List Comments using CLI for Microsoft 365

SharePoint Online lists are a great way to organize and manage data within your organization. They provide a flexible and customizable platform for teams to collaborate and share information. One of the features available in SharePoint Online lists / Microsoft Lists is the ability to add comments to list items. This can be a useful way to provide feedback, ask questions, or share information related to specific items within the list.

However, there may be situations where you want to disable comments for a particular list. This could be because you want to limit the amount of noise or clutter in the comments section, or because you want to encourage users to provide feedback in a different way.

In this blog post, we will walk through the steps required to enable or disable comments for a SharePoint Online list using the CLI for Microsoft 365.

Step 1: Install the CLI for Microsoft 365

Before we can start working with the CLI for Microsoft 365, we need to install it. You can install the CLI for Microsoft 365 by using below NPM commands or by following the instructions on the official documentation page:  CLI for Microsoft 365 – Installation. You have to install CLI for M365 v6.7.0 (beta) or higher.

npm install -g @pnp/cli-microsoft365

You have to use below command if you want to install beta version of CLI for Microsoft 365:

npm install -g @pnp/cli-microsoft365@next

Step 2: Enable or Disable Comments for a SharePoint Online List

To enable or disable comments for a SharePoint Online list, we have to use the m365 spo list set command in the CLI for Microsoft 365. The syntax for this command is as follows:

m365 spo list set --webUrl <site url> --title <list title> --disableCommenting <true/false>

Let’s break down each of these parameters:

  • --webUrl: The URL of the SharePoint Online site where the list is located.
  • --title: The title of the list you want to enable or disable comments for.
  • --disableCommenting: Set this to true to disable comments, or false to enable comments.

Here’s a complete CLI for Microsoft 365 script which you can use to disable comments for a SharePoint Online/Microsoft Lists modern experience list:

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

# Display name of SharePoint list
$listName = "Comments List"

# Get Credentials to connect to SharePoint site
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
    m365 login
}
# Disable SharePoint online list comments
m365 spo list set --webUrl $siteUrl --title $listName --disableCommenting true

You can modify this CLI for M365 script to enable SharePoint list comments by changing the --disableCommenting parameter to false.

Once you run above script successfully, navigate to List Settings > Advanced Settings and you will find that commenting is disabled for your SharePoint online list:

SharePoint List Advanced settings showing disabled commenting on SharePoint Online list or Microsoft Lists using CLI for Microsoft 365
Disabled commenting on SharePoint Online list using CLI for Microsoft 365

Learn more

How to find the Internal name of columns in SharePoint Online?

The internal name of a SharePoint column is a unique name that is automatically generated by SharePoint when a column is created. It is used by SharePoint internally to reference and retrieve the value of a particular column associated with an item or document. The internal name is generated based on the display name you provide but all special characters and spaces will be replaced with Unicode’s by SharePoint. Internal name is generated only once while creating a new column and it cannot be changed even if you change the display name of SharePoint column.

The internal name is not visible to users in the SharePoint user interface by default, but it is commonly used in various scenarios, such as in SharePoint REST APIs, Power Automate flow expressions, Power Apps formulas, PowerShell, etc. to interact with column data programmatically.

Where are Internal names of SharePoint columns used?

  1. Custom Scripts: When creating custom scripts, such as JavaScript or PowerShell, the internal names of columns are required to reference and manipulate the values of the columns while interacting with SharePoint data.
  2. Workflows: In SharePoint Designer workflows or Microsoft Power Automate (formerly known as Microsoft Flow), the internal names of columns are used to reference the values of the columns as inputs or outputs in the workflow actions and in expressions.
  3. Custom Solutions: When building custom solutions, such as SharePoint apps, SharePoint framework (SPFx) web parts, or custom code, the internal names of columns are required to interact with the columns programmatically.
  4. Power Apps: Few of the Power Apps functions like ShowColumns, SortByColumns, etc. requires using internal names of SharePoint columns in formula.
  5. JSON Formatting: Internal name of SharePoint column is required in JSON formatting to reference the column value with [$InternalNameOfColumn] syntax.

How to find the Internal name of a SharePoint column?

Using Modern experience list view

You can use sorting or filtering options from SharePoint online modern experience list view to find the internal name of a SharePoint column. Sort by and Filter by options are supported by most of the column types in SharePoint like Single line of text, Choice, Number, Date and Time, Yes/No (Boolean), Person or Group (single selection), etc.

For this afticle, we will use sorting based on SharePoint choice column as an example:

1. Go to the SharePoint online list for which you want to check the internal name of a column.

2. Click on column name/header from the list view and select either Ascending (A to Z) or Descending (Z to A) option from the popup menu:

Find internal name of SharePoint column by sorting choice column from SharePoint online modern experience list view
Find internal name of SharePoint column by sorting choice column

3. SharePoint will sort the list view based on selection and the browser URL will be changed like:

https://contoso.sharepoint.com/sites/wlive/Lists/InternalNames/AllItems.aspx?sortField=ChoiceColumn&isAscending=false

Where column name (ChoiceColumn) after sortField= is the internal name of your SharePoint choice column.

4. Similarly, when you use Filter by option in SharePoint modern experience to filter the list view based on Date and Time column (named as Start Date), SharePoint changes browser URL like:

https://contoso.sharepoint.com/sites/wlive/Lists/InternalNames/AllItems.aspx?FilterField1=Start_x0020_Date&FilterValue1=2023-04-05&FilterType1=DateTime

Where column name (Start_x0020_Date) after FilterField1= is the internal name of your SharePoint date and time column. Notice _x0020_ in internal column name which is an Unicode encoding of the space character in the display name of date and time column (Start Date).

Using Classic experience List settings page

Few of the SharePoint column types like Multiple lines of text, Hyperlink or Picture, Image, etc. does not support sorting or filtering from SharePoint modern experience list views. So, you have to use the classic experience list settings page to find the internal name for such SharePoint columns.

Follow below steps to find the internal name of multiple lines of text column using SharePoint classic experience list settings page:

1. Go to the SharePoint online list for which you want to check the internal name of a column.

2. Click on Settings (gear) icon from the top right corner and select List settings:

Open SharePoint online List settings page from modern experience list view to find the internal name of SharePoint column
Open SharePoint online list settings page

3. From list settings page, scroll down to the Columns section and click on the column name for which you want to find the internal name:

Open SharePoint online column settings page from classic experience list settings page to find the internal name of SharePoint column
Open SharePoint online Column settings page

4. SharePoint will open column settings page for the respective column with browser URL like:

https://contoso.sharepoint.com/sites/wlive/_layouts/15/FldEdit.aspx?List=%7B6FBA7FAE-AFC0-45D6-99EE-0AB20629EE41%7D&Field=MultilineTextCol
SharePoint online column settings page showing internal name of column
SharePoint online column settings page showing internal name of column

Where column name (MultilineTextCol) after Field= is the internal name of your SharePoint online multiple lines of text column.

Note: You can use this classic experience method to find out the internal name of SharePoint columns for all column types.

Using SharePoint REST API

You can use SharePoint REST API endpoint like below to get the internal name of SharePoint column based on it’s display name. Open URL in below format directly from browser tab:

https://contoso.sharepoint.com/sites/SPConnect/_api/web/lists/getbytitle('InternalNames')/fields?$select=Title,InternalName&$filter=Title eq 'Multiline Text Column'
Find internal name of SharePoint online list column using SharePoint REST API
Find internal name of SharePoint column using SharePoint REST API
Using PnP PowerShell

You can use below PnP PowerShell script to find the internal name of SharePoint online list column using PnP PowerShell:

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

# Display name of SharePoint list
$listName = "InternalNames"

# Display name of SharePoint list column
$columnName = "Multiline Text Column"
 
# Connect to SharePoint online site
Connect-PnPOnline -Url $siteUrl -Interactive
 
# Get internal name of SharePoint list column
Get-PnPField -Identity $columnName -List $listName | Select Title,InternalName
Find internal name of SharePoint online list column using PnP PowerShell
Find internal name of SharePoint column using PnP PowerShell
Using CLI for Microsoft 365

You can use below CLI for Microsoft 365 script to find the internal name of SharePoint online list column using CLI for Microsoft 365:

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

# Display name of SharePoint list
$listName = "InternalNames"

# Display name of SharePoint list column
$columnName = "Multiline Text Column"
 
# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
	m365 login
}

# Get internal name of SharePoint list column
m365 spo field get --webUrl $siteUrl --listTitle $listName --title $columnName --output text
Find internal name of SharePoint online list column using CLI for Microsoft 365
Find internal name of SharePoint column using CLI for Microsoft 365

Best practices for naming SharePoint columns

When creating columns in SharePoint, it’s important to follow best practices for column naming to avoid using special characters or Unicode characters in internal names. Here are some recommended best practices:

  1. Use only alphanumeric characters: Stick to using letters (A-Z, a-z) and numbers (0-9) in column names. Avoid using special characters such as @, #, $, %, _, etc. Avoid column names beginning with numbers.
  2. Avoid spaces: Use PascalCase to separate words in column names instead of spaces. For example, use ColumnName instead of Column Name. This can help prevent issues with URLs, Unicode encoding, and referencing column names in scripts or code.
  3. Avoid reserved words: SharePoint has reserved words that are used for system functionality, and using them in column names may cause conflicts. Examples of reserved words include “ID”, “Modified”, “Created”, “Title”, etc. Avoid using these reserved words as column names.
  4. Keep it concise and meaningful: Use descriptive and meaningful names for columns that clearly indicate their purpose. Avoid using vague or generic names that may be confusing or ambiguous to users. Use column description to provide more information about the columns.
  5. Be consistent: Establish a consistent naming convention for columns across your SharePoint site or site collection to ensure uniformity and ease of management. This can also help with documentation, training, and maintenance of your SharePoint environment.

I hope you liked this article. Give your valuable feedback & suggestions in the comments section below and share this article with others.

Learn more

find-internal-name-of-sharepoint-column-by-sorting-choice-column

ganeshsanapblogs

Find internal name of SharePoint column by sorting choice column from SharePoint online modern experience list view

Open SharePoint online List settings page from modern experience list view to find the internal name of SharePoint column

Open SharePoint online column settings page from classic experience list settings page to find the internal name of SharePoint column

SharePoint online column settings page showing internal name of column

Find internal name of SharePoint online list column using SharePoint REST API

Find internal name of SharePoint online list column using PnP PowerShell

Find internal name of SharePoint online list column using CLI for Microsoft 365

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

SharePoint Online: Apply JSON View formatting using CLI for Microsoft 365

SharePoint Online is a powerful platform for managing and sharing documents and other types of content within an organization. One of the key features of SharePoint Online is its ability to use JSON View formatting to customize the look and feel of lists and libraries.

However, applying JSON View formatting can be a time-consuming and repetitive task, especially if you need to apply the same formatting to multiple sites or lists. Fortunately, we have a command-line tool called CLI for Microsoft 365 that makes it easy to automate this process.

In my previous blogs we saw how to apply SharePoint online JSON view formatting using SharePoint REST API and PnP PowerShell. In this blog post, we will explore how to use CLI for Microsoft 365 to apply JSON View formatting to SharePoint Online lists.

The first step is to install CLI for Microsoft 365. You can do this by following the instructions on the official documentation page: CLI for Microsoft 365 – Installation

Then you can use below CLI for Microsoft 365 script to apply JSON View formatting to your SharePoint online list:

# Display name of SharePoint list
$listName = "Ganesh Sanap Blogs"

# Name of SharePoint list view
$viewName = "All Items"

# JSON to apply to view formatting
$jsonViewFormatting = @'
{
    "$schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
    "additionalRowClass": "=if([$DueDate] &lt;= @now, 'sp-field-severity--blocked', '')"
}
'@

# Get Credentials to connect
$m365Status = m365 status
if ($m365Status -match "Logged Out") {
   m365 login
}

# Apply JSON view formatting
m365 spo list view set --webUrl $siteUrl --listTitle $listName --title $viewName --CustomFormatter $jsonViewFormatting

Where [$DueDate] is the internal name of your SharePoint column.

Once you run above script successfully and navigate to SharePoint list view, you will see that new JSON view formatting is applied to your SharePoint online list view using CLI for Microsoft 365:

SharePoint Online modern experience to apply JSON View formatting using CLI for Microsoft 365
SharePoint Online – Apply JSON View formatting using CLI for Microsoft 365

Conclusion

Using CLI for Microsoft 365, you can easily apply JSON View formatting to your SharePoint Online lists, saving time and reducing the risk of errors. By following the steps outlined in this blog post, you can quickly get started with using CLI for Microsoft 365 to apply JSON View formatting to your SharePoint Online lists.

Learn more

sharepoint-online-apply-json-view-formatting-using-cli-for-microsoft-365

ganeshsanapblogs

SharePoint Online modern experience to apply JSON View formatting using CLI for Microsoft 365

❌
❌