$baseUrl = $projectUrl.TrimEnd('/') + '/_apis/tfvc/' instead it should be $baseUrl = $projectCollectionUrl.TrimEnd('/') + '/_apis/tfvc/'