Arcpy: legend.addItem

Idea created by colton.snelling on Aug 1, 2019
    Reviewed
    Score20
    • colton.snelling
    • csnelling

    I have been trying to find a solution to a problem I have been having for several days now.  I am trying to insert a layer that is in my TOC as an item into my legend.  According to the LegendElement documentation, you can use legend.removeItem to remove a specific item from your layer.  From all of my research and tests, there is not an opposite of removeItem, in my case, addItem.  Having the ability to do legend.addItem to insert an item from the TOC into the legend would extremely useful.  It would also make it even better if we could index where in the legend the new item went.  If legend.removeItem is possible, then surely legend.addItem is possible as well?