Two men – both wearing black hooded tops and trousers – punched and kicked him before one pulled out a knife and stabbed him.
They stole his rucksack which contained a laptop worth around £1,000 before making off towards Ferry Road Drive.
The victim was taken to the Royal Infirmary of Edinburgh and received treatment for his injuries.
A police spokesman said: “This was a vicious and unprovoked attack where the victim suffered significant injuries, and we are appealing for any information that can assist us in tracing those responsible.
“At the time of the attack there was a party ongoing at a nearby property, and some of the occupants came to the aid of the victim following the attack.
“In addition, a black Range Rover was seen to pass by while the assault was taking place.
“We would be keen to speak to any of these potential witnesses, and we are appealing for them to contact us as a matter of urgency.
“Similarly, anyone else with any information that can assist our inquiries should also get in touch.”
Anyone with information should contact Lothian and Borders Police on 0131 311 3131, or Crimestoppers on 0800 555 111.