Solenoid switches have a wide range of uses from water/air valves to electrical relays. In a future project I use a pull type solenoid similar to the one used here to act as a locking mechanism.
The parts you will require are as follows:
The schematic is as follows:
The sketch for this tutorial can be found here.