Is it safe to use a portable microwave in a confined shelfspace?
Microwave ovens do not generate heat themselves, but cause the food itself to heat up. As such there is not a lot of heat output from the unit, but there is expanding air as the food warms the air in the chamber.

Reputable manufacturers are fairly conservative about their venting requirements. If you meet those requirements, you should be OK. 

Another consideration is clearance for the door swing and for moving dishes in and out of the unit. Make sure that its positioning does not cause you to be handling a hot dish at an awkward angle. Also high shelves are a bit risky since you would be handling hot food at head and face level. A singed hand pulled back could lead to a bad scalding.

Finally, you need to be sure that there is an outlet nearby of the proper amperage. A 900 watt microwave draws about 8 amps. A line with a number of other heavy duty appliances on it may pop circuit breakers.