Carbon nitride with different microstructures were synthesized through precursor selection. Low amount of hydrogen bonds in g-C3N4-U was beneficial for the synergetic environmental remediation. The formation of defective and oxygen doped structures was prerequisite for activating oxygen molecules.