Vue normale

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

Hide/Disable Web search external images in SharePoint Online

SharePoint Online offers powerful web parts and features that enhance the visual appeal of your sites, including the ability to search for external images on the web while using web parts like Image, Hero, Image Gallery, Quick links, etc. While this feature can be valuable in various contexts, there are scenarios where organizations prefer to disable or hide the option to search for external images especially when they have created organization assets libraries in the SharePoint tenant.

In this blog post, we’ll explore how to hide/disable the “Web search” feature in SharePoint using SharePoint Online PowerShell, PnP PowerShell and CLI for Microsoft 365.

Using SharePoint Online PowerShell

Use below SharePoint Online PowerShell script to disable or enable external image “Web Search” feature in SharePoint Online tenant:

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

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

# Disable external image "Web Search" feature in SharePoint
Set-SPOTenant -FilePickerExternalImageSearchEnabled $false

# Enable external image "Web Search" feature in SharePoint
# Set-SPOTenant -FilePickerExternalImageSearchEnabled $true

# Disconnect SharePoint online connection
Disconnect-SPOService

Using PnP PowerShell

You can use below PnP PowerShell script to hide/disable external image “Web Search” feature in SharePoint Online:

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

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

# Disable external image "Web Search" feature in SharePoint
Set-PnPTenant -FilePickerExternalImageSearchEnabled $false

# Enable external image "Web Search" feature in SharePoint
# Set-PnPTenant -FilePickerExternalImageSearchEnabled $true

# Disconnect SharePoint online connection
Disconnect-PnPOnline

Using CLI for Microsoft 365

Use below CLI for Microsoft 365 script to remove/disable external image “Web Search” feature in SharePoint Online tenant:

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

# Disable external image "Web Search" feature in SharePoint
m365 spo tenant settings set --FilePickerExternalImageSearchEnabled false

# Enable external image "Web Search" feature in SharePoint
# m365 spo tenant settings set --FilePickerExternalImageSearchEnabled true

# Disconnect SharePoint online connection
m365 logout

Conclusion

Disabling or hiding the web search for external images in SharePoint Online is a strategic choice for organizations that prioritize content security, brand consistency and compliance. By following the methods outlined in this blog post, you can tailor your SharePoint environment to align with your organization’s policies and enhance the overall governance of your digital assets.

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

Enable or Disable the Social Bar (Like, Views, Save for later) in SharePoint at tenant level

SharePoint Online provides various social features in modern experience SharePoint sites. One of the features available for SharePoint site pages is the social bar (Like, No. of Comments, Views, Save for later), which is situated at the bottom of site pages. Social bar allows users to engage with page content by liking and saving pages for later reference. Social bar also shows the number of page views and comments on modern site pages.

However, organizations may have specific requirements that necessitate enabling or disabling the social bar on SharePoint site pages. Unfortunately, there are no settings available for enabling/disabling social bar using SharePoint user interface. In this blog post, we will explore how to achieve this at SharePoint tenant level using SharePoint Online PowerShell, PnP PowerShell and CLI for Microsoft 365 scripts.

Using SharePoint Online PowerShell

Use below SharePoint Online PowerShell script to enable or disable the social bar from site pages for all SharePoint sites in the tenant:

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

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

# Disable the social bar from SharePoint online site pages
Set-SPOTenant -SocialBarOnSitePagesDisabled $true

# Enable the social bar on SharePoint online site pages
Set-SPOTenant -SocialBarOnSitePagesDisabled $false

Using PnP PowerShell

You can use below PnP PowerShell script to show or hide the social bar from SharePoint online modern experience site pages:

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

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

# Show the social bar on SharePoint online modern site pages
Set-PnPTenant -SocialBarOnSitePagesDisabled $false

# Hide the social bar from SharePoint online modern site pages
Set-PnPTenant -SocialBarOnSitePagesDisabled $true

Using CLI for Microsoft 365

Use below CLI for Microsoft 365 script to enable or disable the Social Bar (like, No. of comments, views, Save for later) in SharePoint online at tenant level:

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

# Disable the social bar from SharePoint online site pages
m365 spo tenant settings set --SocialBarOnSitePagesDisabled true

# Enable the social bar on SharePoint online site pages
m365 spo tenant settings set --SocialBarOnSitePagesDisabled false

Conclusion

Enabling or disabling the social bar on site pages in SharePoint Online can be achieved using SharePoint Online PowerShell, PnP PowerShell or CLI for Microsoft 365 scripts. By following the steps outlined in this blog post, you can customize the user experience and align it with your organization’s specific requirements. Whether you want to encourage user engagement or disable social features for certain scenarios, these PowerShell scripts provide the flexibility to control the social bar’s presence on SharePoint online modern site pages.

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

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

Set ou UpdateContext ?

Résumé en bas de page

Difficulté : 1/5

Ces deux fonctions permettent de stocker provisoirement des données dans Power Apps.

Vous pourrez vous en servir pour garder en mémoire du texte, des chiffres, des dates, des objets et tout autre type de données présent dans votre application.

Il est important de souligner que les valeurs qu’elles contiennent sont supprimées une fois l’application fermée.

Si vous souhaitez les conserver, vous devrez utiliser un formulaire ou la fonction Patch pour les enregistrer sur votre base de données ou SaveData pour les sauvegarder localement sur votre téléphone ou tablette.

Une mauvaise utilisation de ces variables peut engendrer des calculs inutiles et impacter la performance de votre application.

SET

Cette fonction permet de définir une variable que vous pourrez utiliser sur l’intégralité des écrans de votre application.

Dans l’idéal, il faudrait qu’un set soit initialisé et jamais modifié. Etant présent dans l’intégralité des pages, un changement pourra avoir une répercussion sur tous les contrôles qui en font l’usage. En fonction de la complexité de votre app, cela peut générer beaucoup de calculs et impacter sérieusement ses performances.

Exemple :

Vous souhaitez gérer l’accès à différents espaces ou fonctionnalités de votre app en fonction de la personne connectée.
Créez la variable _RoleUtilisateurActuel sur la propriété OnStart de votre application et définissez-la par le rôle de la personne enregistrée dans une table de droit.

Set(_RoleUtilisateurActuel ; LookUp( BaseDeDroits; User().Email = EmailDeLaBaseDeDroit ).Role)

Vous pourrez ainsi modifier la propriété Visible d’un bouton pour l’afficher uniquement aux utilisateurs qui ont un rôle de gestionnaire.

_RoleUtilisateurActuel = "Gestionnaire"

Cette variable est initialisée une seul fois, elle ne sera pas modifiée et pourra être utilisée sur tous les écrans.


UpdateContext

A l’inverse du set, cette variable est exploitable dans un écran à la fois.

Ainsi, même si vous utilisez cette variables sur l’intégralité de votre app, aucun calcul ne sera réalisé sur les écrans non visibles.

Elle peut également stocker des tables cependant Collect ou Table sont plus adaptés.

Cette fonction peut s’utiliser de deux façons :

– Stocker une information dans une page : UpdateContext({ _NomDeLaVariable : Valeur })
– Conserver une information en changeant d’écran : Navigate(Ecran2 ; ScreenTransition.Cover ; { _NomDeLaVariable : Valeur })

Résumé

SetUpdateContext
DisponibilitéToute l’applicationUne page
Point fortDisponible partout et initiable dans OnStartSa modification n’engendre pas de calculs sur d’autres écrans
Point faiblePeut ralentir le fonctionnement de l’applicationDoit être initialisé sur chaque écran
Bonne pratiqueStoker des informations légères et ne pas les modifierEmbarquer d’un écran à un autre uniquement les informations utiles

Aller plus loin dans la compréhension des variables : https://docs.microsoft.com/fr-fr/powerapps/maker/canvas-apps/working-with-variables

Pour en savoir plus sur l’optimisation des performances de votre application : https://docs.microsoft.com/fr-fr/powerapps/maker/canvas-apps/performance-tips


J’espère vous avoir aidé à y voir plus clair. Si vous avez des contre-exemples ou d’autres précisions à apporter, partagez-les en commentaire 🙂

burst-aoN3HWLbhdI-unsplash

g2i365

❌
❌