In this post I will show how to create custom ribbon button in specific list for Sharepoint Online. Suppose that we have the following xml file with declaration of the ribbon button:
For more convenient work we create own class for that in order to be able to deserialize it from xml:
With these preparations ribbon button can be created using the following code:
Here we first check that same ribbon button is not added already by comparing titles (lines 7-20) and if not, add new custom ribbon button using data from xml declaration (lines 22-28).