Walk over to the transportation beam and look straight upwards. Set a portal on the chequered wall where the beam hits the ceiling and then travel up into the beam. As you ascend upwards, turn to the left of the chamber and place the second portal on the wall here.
Pick up the Cube and drop it into the transport beam as it’s rising look down back at the ground floor and place an exit portal on the chequered portion of the floor. This’ll automatically push the Cube into the ceiling switch, opening the exit for you.