In this article, we analyze the Casimir-Polder interaction of atoms with a solid grating and the repulsive interaction between the atoms and the grating in the presence of an external laser source. The Casimir-Polder potential is evaluated exactly in terms of Rayleigh reflection coefficients and via an approximate Hamaker approach. The laser-tuned repulsive interaction is given in terms of Rayleigh transmission coefficients. The combined potential landscape above the solid grating is probed locally by diffraction of Bose-Einstein condensates. Measured diffraction efficiencies reveal information about the shape of the potential landscape in agreement with the theory based on Rayleigh decompositions.