Solenoid stroke vs force
Where is the maximum force generated?


The maximum force is generated when the thicker section of the metal rod in your picture is almost fully inserted into the coil. The thinner section of the metal rod is the push actuator, an optional piece needed when you need to push rather than pull.

There is a physical stop in one direction on most solenoids, the metal rod will not go all the way through the coil. There is often no physical stop in the other direction, your design must handle that. 

The return to the un-actuated position is normally handled by a spring or gravity. Some have springs included. Your button spring may suffice.

Not all are rated for 100% duty cycle. The solenoids rated for lower duty cycle will have a larger force. But, if you run them at a higher duty cycle than they are rated, they will overheat.