var map = MapView.Active.Map;
if (map == null) return;
//Get map's metadata
var mapMetadata = map.GetMetadata();
//TODO:Make edits to metadata using the retrieved mapMetadata string.
//Set the modified metadata back to the map.
if (map.GetCanEditMetadata())
map.SetMetadata(mapMetadata);