The selective photoisomerization or photocyclization of stilbene to achieve value upgrade is of great significance in industry applications, yet it remains a challenge to accomplish both of them through a one-pot photocatalysis strategy under mild conditions. Here, a sevenfold interpenetrating 3D covalent organic framework (TPDT-COF) has been synthesized through covalent coupling between N,N,N,N-tetrakis(4-aminophenyl)-1,4-benzenediamine (light absorption and free radical generation) and 5,5′-(2,1,3-benzothiadiazole-4,7-diyl)bis[2-thiophenecarboxaldehyde] (catalytic center). The thus-obtained sevenfold interpenetrating structure presents a functional pore channel with a tunable photocatalytic ability and specific pore confinement effect that can be applied for selective stilbene photoisomerization and photocyclization. Noteworthily, it enables photogeneration of cisstilbene or phenanthrene with >99% selectivity by simply changing the gas atmosphere under mild conditions (Ar, Sele Cis . > 99%, Sele Phen . < 1% and O 2 , Sele Cis . < 1%, and Sele Phen . > 99%). Theoretical calculations prove that different gas atmospheres possess varying influences on the energy barriers of reaction intermediates, and the pore confinement effect plays a synergistically catalytic role, thus inducing different product generation. This study might facilitate the exploration of porous crystalline materials in selective photoisomerization and photocyclization.