Today, while trying generate a model, using SPMetal, I found out that SPMetal does not like spaces in the web URL. After trying the URL in quotes with the space and again with %20 in the string for the URL encoding seen below. Neither of them were able to find the application.
SPMetal /web: ”http://sharepoint/services/Rota Management” /namespace: etc
SPMetal /web: ”http://sharepoint/services/Rota%20Management” /namespace: etc
Resulting in the following errors respectively
Error: Web at http://sharepoint/services/Rota Management could not be found.
Error: Web at http://sharepoint/services/Rota0Management could not be found.
So in order to get the model definition I used the following PowerShell command.
Start-SPAssignment –Global
$web = Get-SPWeb "http://sharepoint/services/Rota Management"
$web.ServerRelativeUrl = "/services/RotaManagement"
$web.Update()
Stop-SPAssignment –Global
Then, I ran the SPMetal command again and it worked no problem.
After generating the class just reversed the above to restore the URL
