Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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 export.run.

The url I am sending for the export

//vinay10:2434/sites/99156/test112/111

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 export.run. 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

1 Answer 1

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 export.run() . 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

 
discard

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.