Electromagnet with Adafruit motorshield

or maybe I put a resistor in series with the electromagnet? I only have room for a 1in long electromagnet with radius of a 1/2". Im not sure how many turns or wire length that could fit. maybe 500 turns like 700ft max maybe idk. But also id rather keep the radius smaller that is just max but can do it