Question

I'm currently trying to create a Sub Web on a Site. The problem I'm faced with is that for some reason I'm getting an strange error message.

Additional information: "http://dev-env/sites/site/subsite/" contains invalid character ':'.

As far as I can tell I'm not using any invalid characters.

elevatedWeb.Webs.Add(strWebUrl, title, strDescription, nLCID, WebTemplate, uniquePerms, bConvertIfThere);

Any tips?

Was it helpful?

Solution

This is because you are passing the full url instead of relative url

Replace

http://dev-env/sites/site/subsite/

With

subsite

i.e

elevatedWeb.Webs.Add(title, title, strDescription, nLCID, WebTemplate, uniquePerms, bConvertIfThere);
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top