Dorothy has risen from bed for the day and is seeing to her friends in the Emerald City and notices that Ozma has not awakened yet. Dorothy goes into Ozma's chambers only to find she is not there.
Glinda awakens in her palace in the Quadling Country and finds her Great Book of Records is missing. She goes to prepare a magic spell to find it- only to see her magic tools are gone as well. She dispatches a messenger to the Emerald City to relay news of the theft. Receiving the news, the Wizard hastily offers his magic tools to assist Glinda, however, these are missing as well. Glinda, Dorothy, and the Wizard organize search parties to find Ozma and the missing magic. Accompanying them are Button-Bright, Trot, and Betsy Bobbin. Dorothy and the Wizard's party begins to search the Winkie Country to the west of the Emerald City.
Meanwhile, in the southwestern corner of the Winkie Country on a plateau belonging to the Yips, and Cayke the cookie cook has had her diamond-studded gold dishpan stolen. The self-proclaimed adviser to the Yips, a human-sized dandy of a frog called the Frogman, hears Cayke's story and offers to help her find the dishpan. When they have gotten down the mountain, Cayke reveals to the Frogman that the dishpan has magic powers, for her cookies come out perfect every time.
Dorothy, the Wizard, and their party enter the previously unknown communities of Thi and Herku. The citizens of Thi are ruled by the High Coco-Lorum (really the King, but the people do not know it) and repeat the same story about the Herkus: they keep giants for their slaves. In the Great Orchard between Thi and Herku, the party enjoys a variety of fruits. Button-Bright eats from the one peach tree in the orchard. When he reaches the peach's center he discovers it to be made of gold. He pockets the gold peach pit to show Dorothy, Betsy, and Trot later â despite warnings from the local animals that the evil Ugu the Shoemaker has enchanted it.
In the city of Herku, Dorothy and the Wizard's party are greeted by the emaciated but jovial Czarover of Herku, who has invented a pure energy compound called zosozo that can make his people strong enough to keep giants as slaves. The Czarover offers them six doses to use in their travels and casually reveals that Ugu the Shoemaker came from Herku. Ugu found magic books in his attic one day because he was descended from the greatest enchanter ever known and learned over time to do a great many magical things. The Shoemaker has since moved from Herku and built a castle high in the mountains. This clue leads Dorothy and the Wizard to think that Ugu might be behind all the recent thefts of magic and the ruler of Oz. They proceed from Herku toward the castle and meet with the Frogman, Cayke the Cookie Cook, and the Lavender Bear the stuffed bear who rules Bear Center. Lavender Bear carries the Little Pink Bear a small wind-up toy that can answer any question about the past put to it.
When the combined party arrives at Ugu's castle, Button-Bright is separated from them and falls into a pit. Before they rescue him, the Wizard asks the Little Pink Bear where Ozma is and it says that she is in the pit, too. After Button-Bright is let out of the pit, the Little Pink Bear says that she is there among the party. Unsure what to make of this seeming contradiction, the party advances toward the castle. Sure enough, Ugu is the culprit and the castle's magical defenses are techniques from Glinda and the Wizard. Upon overcoming these, the party finds themselves standing before the thief himself.
Ugu uses magic to send the room spinning and retreats. Dorothy stops it by making a wish with the magic belt. She uses its power to turn Ugu into a dove, but he modifies the enchantment so he retains human size and aggressive nature. Fighting his way past Dorothy and her companions, Ugu the dove uses Cayke's diamond-studded dishpan to flee to the Quadling Country.
Once the magic tools are recovered, the conquering search party turns their attention to finding Ozma. The Little Pink Bear reveals that Ozma is being carried in Button-Bright's jacket pocket, where he placed the gold peach pit. The Wizard opens it with a knife, and Ozma is released from where Ugu had imprisoned her. She was kidnapped by Ugu when she came upon him stealing her and the Wizard's magic instruments.
The people of the Emerald City and Ozma's friends all celebrate her return. Days later, the transformed Ugu flies in to see Dorothy and ask her forgiveness for what he did. She offers it and offers to change him back with the Magic Belt, but Ugu has decided that he likes being a dove much better.

Question: When did Ugu capture and imprison Ozma?
Answer: Ugu captured and imprisoned Ozma when she caught him stealing the magic instruments.