Skip to main content
added 1706 characters in body
Source Link
bob
  • 113
  • 5

I want to add some CustomActions to a document library. I tried to follow this description:

https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-lists-and-libraries#editcontrolblock-user-custom-actions

I have tried it with a Team and a Communicationsite, NoScript should be disabled by "Allow users to run custom script on [] sites" in the SharePoint admin center. In each there is a document library called 'foo'.

The Script runs with no error, but also with no (visible) result. What am i doing wrong?

Edit:

As requested the XML and the Powershellscript. Didn't integrated it earlier, because it's, except from the url and the path, the same as in the documentation

XML

<pnp:ProvisioningTemplate ID="EditControlBlockSamples" Version="1" xmlns:pnp="http://schemas.dev.office.com/PnP/2015/12/ProvisioningSchema">
  <pnp:CustomActions>
    <pnp:SiteCustomActions>
      <pnp:CustomAction Name="CA_1" Description="ca 1" Location="EditControlBlock" RegistrationType="List" RegistrationId="101" Title="CA 1 Title" Sequence="3000" Url="https://contoso.azurewebsites.net/pages/index.aspx" Enabled="true"/>
      <pnp:CustomAction Name="CA_2" Description="ca 2" Location="EditControlBlock" RegistrationType="ContentType" RegistrationId="0x0101" Title="CA 2 Title" Sequence="4000" Url="https://contoso.azurewebsites.net/pages/index.aspx" Enabled="true"/>
    </pnp:SiteCustomActions>
  </pnp:CustomActions>
</pnp:ProvisioningTemplate>

Powershell

# Connect to a previously created Modern Site
$cred = Get-Credential
Connect-PnPOnline -Url https://[tenant].sharepoint.com/sites/[mysiteurl] -Credentials $cred

# Apply the PnP provisioning template
Apply-PnPProvisioningTemplate -Path c:\[my_path_to_xml] -Handlers CustomActions

Edit2:

I've read somewhere, that i might have some old librarys, so i deinstalled and installed newer one with

Uninstall-Module -Name SharePointPnPPowerShellOnline -AllVersions -Force
Install-Module -Name PnP.PowerShell

But i now just need to use Invoke-PnPSiteTemplate (see 'Changes' under https://pnp.github.io/powershell/articles/upgrading.html) and it's still not working.

I want to add some CustomActions to a document library. I tried to follow this description:

https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-lists-and-libraries#editcontrolblock-user-custom-actions

I have tried it with a Team and a Communicationsite, NoScript should be disabled by "Allow users to run custom script on [] sites" in the SharePoint admin center. In each there is a document library called 'foo'.

The Script runs with no error, but also with no (visible) result. What am i doing wrong?

I want to add some CustomActions to a document library. I tried to follow this description:

https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-lists-and-libraries#editcontrolblock-user-custom-actions

I have tried it with a Team and a Communicationsite, NoScript should be disabled by "Allow users to run custom script on [] sites" in the SharePoint admin center. In each there is a document library called 'foo'.

The Script runs with no error, but also with no (visible) result. What am i doing wrong?

Edit:

As requested the XML and the Powershellscript. Didn't integrated it earlier, because it's, except from the url and the path, the same as in the documentation

XML

<pnp:ProvisioningTemplate ID="EditControlBlockSamples" Version="1" xmlns:pnp="http://schemas.dev.office.com/PnP/2015/12/ProvisioningSchema">
  <pnp:CustomActions>
    <pnp:SiteCustomActions>
      <pnp:CustomAction Name="CA_1" Description="ca 1" Location="EditControlBlock" RegistrationType="List" RegistrationId="101" Title="CA 1 Title" Sequence="3000" Url="https://contoso.azurewebsites.net/pages/index.aspx" Enabled="true"/>
      <pnp:CustomAction Name="CA_2" Description="ca 2" Location="EditControlBlock" RegistrationType="ContentType" RegistrationId="0x0101" Title="CA 2 Title" Sequence="4000" Url="https://contoso.azurewebsites.net/pages/index.aspx" Enabled="true"/>
    </pnp:SiteCustomActions>
  </pnp:CustomActions>
</pnp:ProvisioningTemplate>

Powershell

# Connect to a previously created Modern Site
$cred = Get-Credential
Connect-PnPOnline -Url https://[tenant].sharepoint.com/sites/[mysiteurl] -Credentials $cred

# Apply the PnP provisioning template
Apply-PnPProvisioningTemplate -Path c:\[my_path_to_xml] -Handlers CustomActions

Edit2:

I've read somewhere, that i might have some old librarys, so i deinstalled and installed newer one with

Uninstall-Module -Name SharePointPnPPowerShellOnline -AllVersions -Force
Install-Module -Name PnP.PowerShell

But i now just need to use Invoke-PnPSiteTemplate (see 'Changes' under https://pnp.github.io/powershell/articles/upgrading.html) and it's still not working.

Source Link
bob
  • 113
  • 5

Add CustomActions to a document library

I want to add some CustomActions to a document library. I tried to follow this description:

https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-customize-lists-and-libraries#editcontrolblock-user-custom-actions

I have tried it with a Team and a Communicationsite, NoScript should be disabled by "Allow users to run custom script on [] sites" in the SharePoint admin center. In each there is a document library called 'foo'.

The Script runs with no error, but also with no (visible) result. What am i doing wrong?