Ask you friend to create an account in CIC and link the application with UCI and Application number .
before you do that answer few questions.
1) Was the application online or offline?
1a) if it was offline did he went to submit his application?
2) did he gave his biometric?
Visa officer thinks differently they valuate our present with different parameters ( they just wanna know why would one go back to home country) .
To know the exact reason for your refusal apply GCMS notes .
They can apply for Visitor visa bt chances are less for positive outcome . You will have to show very strong ties to home country and need string reason why would they return to home country .
First apply for GCMS notes that we will give you detail reason why your application was refused , once you have them you can present your case with proper documents.
You wont be able to excess any documents which were uploaded, Invitation letter must have been provided by you to your agent . If you can share a screen shot of your submitted documents list i will be able to say
When you crossed Canadian border by mistake , Did border petrol officer gave you anything in writing or did they noted down your detail ?
When did this happened ?
For canada refusal apply for GCMS note to get detail reason that will help you to prepare your next application.