Tuesday, July 13, 2010
« PowerShell quickie: Extract the feature ... | Main | SPEndpointAddressNotFoundException error... »

 

Currently when generating a class with SPMetal from a site that has spaces in it

SPMetal.exe  /web:"http://flxdev2010:19000/PWA/Test Plan" /namespace:ProjectSite /code:ProjectSite.cs

It will give

Error the web at 'http://flxdev2010:19000/PWA/Test Plan' could not be found

Oh dear, a schoolboy error.

Now you could use stsadm to dump out the site, delete and reimport, yikes. Or you can just rename the Url as ServerRelativeUrl is read/write (any outside links point to the Url will not be fixed up!)

Using a quick console app


            using (SPSite site = new SPSite("http://flxdev2010:19000/PWA/Test Plan"))

            using( SPWeb web = site.OpenWeb())

            {
               string s = web.ServerRelativeUrl;
               web.ServerRelativeUrl = "/PWA/TestPlan";
               web.Update();

            }

or that new fangled 4 year old PowerShell thingy

Start-SPAssignment -Global

$web.Title = "/PWA/TestPlan"
$web.Update()
Stop-SPAssignment -Global

SPMetal.exe  /web:"http://flxdev2010:19000/PWA/TestPlan" /namespace:ProjectSite /code:ProjectSite.cs

now works.

you can change it back once you have the definition.

 

Tuesday, July 13, 2010 9:28:32 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  |  Related posts:
SPEndpointAddressNotFoundException error in Dashboard Designer

Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview