Sample preparation is an indispensable process in sample analysis. Solid-phase extraction technology can isolate and enrich target analytes from complex matrices, eliminating potential interferences and improving method parameters such as sensitivity, accuracy and precision. Carbon nitride framework materials (CNFs) consisted with tri-s-triazine units have attracted increasing attention as solid-phase extractants in analytical fields. The affluent in-built N-rich functional groups and large delocalized large π bonds structure endow CNFs excellent extraction capacity and selectivity based on chemical complexation, ions exchange, strong π-π conjugation, hydrogen bond interaction and electrostatic interaction. In this review, we focus on the advancements of CNFs materials in sample preparation. The preparation methods of CNFs with different chemical structures are introduced. Besides, modification strategies for improving adsorption efficiency and selectivity of CNFs are summarized. Finally, the applications of CNFs in inorganic and organic extraction and analysis (pesticide residues, foods and environment pollution analysis) are reviewed.