The writ must be issued in all cases when there is not a plain, speedy, and adequate remedy in the ordinary course of law. It must be issued upon affidavit upon the application of the party beneficially interested except those writs issued sua sponte by the supreme court.
N.D.C.C. § 32-34-02