The infiltration of ferrofluids inside microstructured optical fiber Bragg gratings enables photonic devices with spectral behavior that can be stimulated by external magnetic fields.