Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

Exporting web with retain of GUID

$
0
0
Hi
I create a web with webpart page, on wich all webparts are connected and some web parts represents lists on this web.
I need to transfere this web to another server (but only this page).
This code supose to do a trick but it's not working correctly (and no error apears).

This code is importing web site, but not to http://wssdemo-os:85/test
but http://wssdemo-os:85
 static void Main(string[] args)

        {

            export();

            import();

        }



        static void export()

        {

            SPSite site = new SPSite("http://wssdemo-os:82");

            SPWeb web = site.RootWeb;



            SPExportObject exportObject = new SPExportObject();

            exportObject.Id = web.ID;

            exportObject.IncludeDescendants = SPIncludeDescendants.All;

            exportObject.Type = SPDeploymentObjectType.Web;



            SPExportSettings settings = new SPExportSettings();

            settings.SiteUrl = "http://wssdemo-os:82";



            settings.ExportMethod = SPExportMethodType.ExportAll;

            settings.FileLocation = @"c:\export";

            settings.FileCompression = true;

            settings.ExcludeDependencies = false;

            settings.BaseFileName = "exportfile.cmp";

            settings.ExportObjects.Add(exportobj);



            SPExport export = new SPExport(settings);

            export.Run();



            web.Dispose();

            site.Dispose();

        }



        static void import()

        {

            SPImportSettings settings = new SPImportSettings();

            settings.SiteUrl = "http://wssdemo-os:85";

            settings.WebUrl = "http://wssdemo-os:85/test";

            settings.FileLocation = @"c:\export";

            settings.FileCompression = true;

            settings.BaseFileName = "exportfile.cmp";

           

            settings.RetainObjectIdentity = true;

            SPImport import = new SPImport(settings);

            import.Run();

        }


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>