When using the API to create a site in a SPSSiteCollection, if you want the return to “portal” link to appear there is a couple of extra steps that you need to do not listed in the MS docs.
Thanks to Sharepoint Explorer, I found out what they are, but they have to be done in the correct order.
SPGlobalAdmin globalAdmin = new SPGlobalAdmin();
SPSiteCollection sites = globalAdmin.VirtualServers.Sites;
newSiteCollection = sites.Add(“sites/NewSiteName”, “Title”, “Description”, 1033, “STS#0”,
“domain\user”, “Owner_User_Name”, “Owner_Email”);
newSiteCollection.PortalUrl = globalAdmin.VirtualServers.Sites.PortalUrl;
newSiteCollection.PortalName = globalAdmin.VirtualServers.Sites.PortalName;
The additional end two statements are required, the Url first, if this is not set you cannot set the PortalName and it does not throw and exception.
Many thanks to “Mad” ?(sp) for the article on getting these sites into the sites list and searchable.