If this is for a software-only project as an exercise, then just monitor the microswitch via some communication method (or with Events) and disable the elevator movement in the switch direction when the switch is active.
If this is for a real elevator, please take care to consider logic directions and the effects of e.g. broken wires and shorts on your elevator. I expect there are specific safety standards in your country that govern how such a system should be connected, and may also describe (in at least some form) the appropriate software behaviour.
For example, in the case I described for the software exercise, a short in the wire would prevent the elevator moving (which might be frustrating for passengers) but a broken wire might allow your elevators' motors to keep trying to drag it into the ceiling - potentially much more dangerous?