You don't do that.
Makes no sense. Please post links to the datasheet of that solenoid.
Solenoids needs drivers.
Please read this link and note how to post code: How to get the best out of this forum - Using Arduino / Project Guidance - Arduino Forum