Last active
September 11, 2017 14:37
-
-
Save ypcode/f0b8d980b2b8c2a7dd77b1f520634c86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script allows to associate a SPFx ListViewCommandSet extension to a list type (100) | |
###################################################################### | |
# Due to some inconsistency in accepted Cmdlet arguments | |
# We need to work around it by updating manually the RegistrationId and RegistrationType values | |
# The ClientSideComponentProperties is required even if the extension don't need any property | |
###################################################################### | |
# Target web URL | |
$targetWebUrl = "https://yourtenant.sharepoint.com/sites/yoursite" | |
# Set the name of your custom action here | |
$customActionName = "MARK_AS_IMPORTANT" | |
# Copy here the value of your component Id. It can be found in the manifest file of your component in your SPFx solution | |
$componentId = "30fb80ad-539e-4e30-8fd7-dbd2fd4bf514" | |
###################################################################### | |
Connect-PnPOnline $targetWebUrl | |
Add-PnPCustomAction -Name $customActionName -Title "Mark as Important" -ClientSideComponenId $componentId -ClientSideComponentProperties "{}" -Location "ClientSideExtension.ListViewComandSet.CommandBar" | |
$c = Get-PnPCustomAction | ?{$_.Name -eq $customActionName} | |
$c.RegistrationId = 100 | |
$c.RegistrationType = [Microsoft.SharePoint.Client.UserCustomActionRegistrationType]::List | |
$c.Update() | |
Execute-PnPQuery |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment