charging and discharging capacitors
You really asked two questions:

Can a stepper motor be used as a generator?

Can a charged capacitor activate a solenoid?



Yes and yes.

Stepper motors almost always have permanent magnets, so just spinning the shaft will cause each winding to produce a voltage.  Each winding should produce the same AC waveform, but at a different phase.  Each would have to be rectified separately onto the DC bus.  The stepper motor must also be turned at some minimum speed to get enough AC voltage out to overcome the diode forward drops.  Lower than that speed, there will be no DC output.  The unloaded AC output voltage will be proportional to speed, so at some level it should be possible to get a reasonable DC voltage.  The details depend on the stepper motor, and can vary greatly.  Note that while stepper motors are usually driven rather slowly in normal operation, there is no such restriction when running it backwards as a generator.  You should therfore be able to get substantial voltage from such a stepper.  The easiest way to get some idea what you can get out is to watch the voltage of one winding on a scope while twirling the shaft.

Obviously, the resulting DC voltage can be used to charge a cap.

If a capacitor holds enough energy at the right voltage, it can activate a solenoid for a short time.  You need the solenoid particulars to compute the capacitance required to activate it.  Find out how much current the solenoid draws at what voltage and for how long this needs to be held to activate it.

If you are asking about a trigger circuit to turn on the solenoid when the cap gets to a certain voltage, then that is possible too.  The simplest, but not most efficient, way is to use the capacitor voltage to fire a SCR, which in turn discharges the cap onto the solenoid.  You have to adjust the voltage divider from the cap to the SCR gate so that it fires as the desired cap voltage.  This requires only two resistors and the SCR.

I would probably use a tiny micro like the PIC 10F204.  It includes a fixed voltage reference, comparator, and internal oscillator.  These are all the elements you need to determine if the capacitor is at high enough voltage, and then to time the turning on of a low side FET switch to discharge the cap onto the solenoid.