SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a content database to a sql server which is used by Sharepoint 2010.

Using central administration, I am able to browse the sites and export the sites.

I worte a program to use the Sharepoint APIs to do the same but I get the following error. I am filling the settings structure and calling

The url I am sending for the export


vinay10:2434 is the central admin webapp.

SPExportObject exportObject = new SPExportObject(); exportObject.Id = id; exportObject.Type = SPDeploymentObjectType.Web; exportObject.IncludeDescendants = SPIncludeDescendants.Content; settings.UnattachedContentDatabase = contentdatabase;settings.ExportObjects.Add(exportObject);SPExport export = new SPExport(settings);export.Run();

And using the central admin too it shows similar values --- //vinay10:2434/sites/99156 is the site collection

sites/99156/test112/111 is the site.

I attached the content database also before calling But I get the following error. Can any one tell me what I am missing?

System.IO.FileNotFoundException: sites/99156/temp2/111 at Microsoft.SharePoint.Administration.SPUnattachedDatabaseUtility.LookupIdContentDatabase(SPContentDatabase database, String serverRelativeUrl) at Microsoft.SharePoint.SPSite..ctor(SPContentDatabase contentDatabase, Uri requestUri, Boolean isHostHeader) at Microsoft.SharePoint.Deployment.SPExport.InitializeExport()

share|improve this question

Are you sure the url to the site is server relative? Mostly they are site collection relative, ie:

//vinay10:2434/sites/99156 is the site collection

test112/111 is the site. Use this url if you can.

share|improve this answer
While setting the settings of the export function before calling . If I try to add the server ralative url it complaints that its not a valid url . I tried that too but the exception comes while setting the url in settings.url Heres the code – vinay Aug 6 '12 at 19:04
Hi I got the solution , I was setting the weburl in the settings instead of teh sitecollection url. – vinay Aug 8 '12 at 15:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.