The behaviour of molecules in confined environments is typically studied in synthetic systems by trapping them inside molecular cages or porous materials. Now, the properties of photosensitive metal–diimine complexes incorporated in the scaffold of a metal–organic framework, rather than in its cavities, have been investigated.