4f occupation and hybridization from M-shell excitations in Rare-Earth materials