§1. An ecclesiastical office is any function constituted in a stable manner by divine or ecclesiastical ordinance to be exercised for a spiritual purpose.
§2. The obligations and rights proper to individual ecclesiastical offices are defined either in the law by which the office is constituted or in the decree of the competent authority by which the office is at the same time constituted and conferred.
Source: Code of Canon Law (Vatican.va)