The potentiality of high energy XANES (X-ray absorption near edge structure) as a structural tool for lanthanoid-containing systems has been explored. The K-edge XANES spectra of La3+, Gd3+, and Lu3+ ions both in DMSO solution and solid octakis(DMSO) lanthanoid(III) iodides have been analysed. Although the K-edges of lanthanoids cover the energy range 38 (La) to 65 (Lu) keV, the large widths of the core hole states do not appreciably reduce the potential structural information of XANES data. We show that, for lanthanoid compounds, accurate structural parameters are obtained from the analysis of K-edge XANES signal if a deconvolution procedure is carried out. We found that in solid octakis(DMSO) lanthanoid(III) iodides the Ln3+ ions are coordinated by eight DMSO ligands arranged in a quite symmetric fashion. In DMSO solution the Ln3+ ions retain a regular eight-coordination structure and the coordination number does not change along the series. At variance with water the second coordination shell has been found to provide a negligible contribution to the XANES spectra of Ln3+ ions in DMSO solution.