Ab initio many-body treatment of the electronic structure of metals