Wiring A Switched Outlet Power To Receptacle. This way the outlet is wired and controlled on off through the switch. In this case you must change the cable from the switch to the light outlet from a 2 wire to a 3 wire cable.
Switched outlet wiring diagram depicts the electrical power from the circuit breaker panel entering the switched electrical receptacle outlet box where a two wire cable goes to the switch and another two wire cable feeds power to another outlet that is live at all times. Attach the white wire to the silver screw on the side with the longer prong. Connect the last switch in the usual manner looping the wire around the screw in a clockwise direction.
As you can see connecting a receptacle to the light would see the receptacle only hot when the light switch is on.
The problem is when the power comes to the switch and then from the switch to the light outlet or lights and only on a 2 wire cable. As you can see connecting a receptacle to the light would see the receptacle only hot when the light switch is on. Wiring the outlet is simple. These electrical wiring diagrams show typical connections.