Like Daniel said, this is considered a bad practice, but if you still want it you can do it with a PowerShell script:
Param(
[string]$tfvcRepoPath
)
$artifactsFolderPath = "$($env:Agent_BuildDirectory)\newCode"
$tempWorkspacePath = "$($env:Agent_BuildDirectory)\tempWorkspace"
New-Item -Path $artifactsFolderPath-ItemType directory
Copy-Item -Path "$($env:Build_ArtifactStagingDirectory)/*" -Recurse -Destination $artifactsFolderPath
New-Item -Path $tempWorkspacePath -ItemType directory
cd $tempWorkspacePath
$tfExe = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe"
& $tfExe workspace /collection:{TfsCollection} /new "TempWorkspace" /noprompt
& $tfExe workfold "$($tfvcRepoPath)" $tempWorkspacePath
Copy-Item -Path "$($artifactsFolderPath)/*" -Recurse -Destination $tempWorkspacePath
& $tfExe add * /recursive /noignore
& $tfExe checkin /recursive /comment:"artficats after build"
& $tfExe workspace /delete /collection:{TfsCollection} "Tempworkspace"
cd c:/
Remove-Item -Path $newCodeFolderPath -Force -Recurse
Remove-Item -Path $tempWorkspacePath -Force -Recurse
Change the $tfExe = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe"
regarding your installed Visual Studio version (I used the path for VS 2017 Professional edition).