Deep Dive into the SharePoint Content Deployment and Migration API – Part 1


[Part 1Part 2Part 3Part 4Part 5 – Part 6 – Part 7]

Introduction 

Today I would like to start an article series on an interesting new feature in WSS 3.0: the Content Deployment and Migration API. A similar API has previously been provided in MCMS 2002 and was also added to WSS after MCMS was integrated in MOSS 2007. This first part will provide an overview about the API itself. In future chapters I will then demonstrate how to utlize this API to enhance your own applications or to get a better granularity than the out of the box tools allow you to do – e.g. how to copy a document library or a list to a different site collection.

WSS and MOSS use this API at various different places:

  • Content Deployment
  • STSADM -o export and import
  • Copy/Move operations in Site Manager
  • Variations
  • MCMS 2002 database migration to MOSS 2007

Actually any time when content needs to be copied or moved to a different location either in the same or in a different site collection.


Feature set of the Content Deployment and Migration API

The Content Deployment and Migration API provides the following features:

  • export an entire site collection
  • export a specific site inside a site collection including or excluding content in subsites
  • export a list or document libraries or even of a folder inside a document library
  • export a single list items or documents from a document library
  • export dependent objects (like images referenced by a page) by following links
  • generate as a compressed export file or in uncompressed format
  • allow export with a define a maximum size for the generated compressed file (multiple export files will be created if required)
  • allow incremental export of items based on a given change token. This will export all items that have been created, changed or deleted after the timestamp in the change token.
  • import the exported content with or without identiy preservation (means items will keep their GUID or not)
  • import the exported content under the same or a differnt parent in the destination database
  • do link fixup during import

For people who have also worked with Microsoft Content Management Server (MCMS) 2002 here is a feature comparison between the site deployment API of CMS 2002 and the content deployment and migration API coming with WSS:

   
MCMS 2002
 
WSS 3.0
incremental deployment  
yes
 
yes
full deployment  
no
 
yes
deployment of a subtree of the site structure  
yes
 
yes
deployment of specific selected items  
no
 
yes
deployment of dependent items  
yes
 
yes
deployment by ignoring the dependencies  
no
 
yes
deployment of child elements of the exported elements  
yes
 
yes
deployment without exporting of child elements  
no
 
yes
import with preservation of the last modified date of the source item  
no
 
yes
import without preservation of the last modified date of the source item  
yes
 
yes
export of image libraries/resource galleries  
no
 
yes
support import at multiple locations in the site hierarchy  
no
 
yes
can be used to migrate 3rd party content  
no
 
yes


Programming Reference

Assembly: Microsoft.SharePoint.dll
Namespace: Microsoft.SharePoint.Deployment

Important Objects:

  • SPExport – controls the Export process
  • SPExportSettings – used to configure the export process
  • SPExportObject – defines which objects need to be exported
  • SPImport – controls the import process
  • SPImportSettings – used to configure the import process

You will find details about these objects in the MSDN:
http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.deployment.aspx

Rather than listing all the different properties and methods of these objects (which are already documented on MSDN) I will explain how to use these objects by providing some “real-world” samples in the next chapters:

  • Part 2 – Providing some real world samples on export
  • Part 3 – Providing some real world samples on import
  • Part 4 – Advanced content deployment scenarios
  • Part 5 – Avoiding common problems
  • Part 6 – Requirements for a successful content deployment

Comments (114)

  1. Anonymous says:

    Stefan is back! J Stefan is in Redmond this week, and we had a chance to catch up! In fact, I had dinner

  2. Anonymous says:

    Stefan Goßner taucht in einer vierteiligen Serie in die Tiefen der SharePoint Deployment und Migration

  3. Anonymous says:

    [ Part 1 – Part 2 – Part 3 – Part 4 ] Providing some real world samples for import After we managed to

  4. Anonymous says:

    [ Part 1 – Part 2 – Part 3 – Part 4 ] Providing some real world samples for export To demonstrate how

  5. Anonymous says:

    Fantastic, incredibly detailed, content on content deployment by Stefan

  6. Anonymous says:

    [via Stefan Gossner ] This past week I was in Redmond teaching my WCM401 development class in an open

  7. Anonymous says:

    En la última versión de SharePoint se ha incluido un interesante conjunto de herramientas que permite

  8. Anonymous says:

    Body: Great series of posts by Stefan on how to use the Content Migration API. Very timely for me as

  9. Anonymous says:

    If you haven’t seen it already, Stefan Goßner has published a great series on how to develop using the

  10. Anonymous says:

    Stefan Goßner has published a four article series on how to develop using the Content Deployment and

  11. Anonymous says:

    今天凌晨加班的时候偶然翻到 Stefan Gossner 的这几篇文章,强烈推荐给大家: Deep Dive into the SharePoint Content Deployment and Migration

  12. David Remillard says:

    I’m having difficulty with export/import of a site from one farm to another.  The problem has to do with the Data View Web Parts that are in the site.  Apparently, they persist reference to the GUID of the datasource (list)?  Do you have any guidance for this scenario?  Thanks.

  13. Hi David,

    is the list the data view web part points to also in the package?

    Anyway: I would suggest to open a support call to get investigated if this should work or not.

    I personally haven’t looked into the details of this till now.

    Cheers,

    Stefan

  14. Anonymous says:

    Stefan Goßner has put together a terrific 4-part series on the SharePoint Content and Deployment API

  15. Anonymous says:

    Great set of articles by Stefan Goßner : Deep Dive Into the SharePoint Content Deployment…

  16. Anonymous says:

    MOSS / SharePoint Content Deployment

  17. Anonymous says:

    Having focused on deployment using Features for several articles, back in May I wrote an article titled

  18. Anonymous says:

    Back in May I wrote a post titled SharePoint deployment options : Features or Content Deployment? , which

  19. Jenny says:

    Can you deploy content from a MOSS environment to a WSS environement?

  20. Hi Jenny,

    MOSS is on top of WSS. As long as you are only using WSS features in the deployed content it will work. As soon as you are trying to deploy content that is bound to features which are only available in MOSS it will fail.

    Cheers,

    Stefan

  21. Anonymous says:

    Around the time work started on a long whitepaper about migrating content files from SharePoint server

  22. Anonymous says:

    Around the time work started on a long whitepaper about migrating content files from SharePoint server

  23. gbelzile says:

    FYI… the diagram is truncated on the right.

  24. Maybe on your screen.

    Not with a screen width of 1200 and more.

  25. Bramley says:

    Hi Stefan

    I have been working with content deployment in MOSS2007. It worked well before. Currently I’m getting the following error:

    <?xml version="1.0" encoding="utf-8" ?>

    – <ArrayOfReportMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;

     <ReportMessage Title="Unknown compression type in a cabinet folder" Time="2008-01-29T13:40:31.2983868Z" Severity="Error" Phase="ExportInProgress" />

     <ReportMessage Title="Failed to create package file. at Microsoft.SharePoint.Deployment.ExportDataFileManager.<>c__DisplayClass2.<Compress>b__0() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.Deployment.ExportDataFileManager.Compress(SPRequest request) at Microsoft.SharePoint.Deployment.SPExport.Run() *** Inner exception: Unknown compression type in a cabinet folder at Microsoft.SharePoint.Library.SPRequest.BuildCabinetFile(String bstrTempDirectory, String bstrCabFileLocation, UInt32 uMaxCabFileSize) at Microsoft.SharePoint.Deployment.ExportDataFileManager.<>c__DisplayClass2.<Compress>b__0()" Time="2008-01-29T13:40:35.5170828Z" Severity="Error" Phase="ExportInProgress" />

     <ReportMessage Title="Content deployment job ‘NewCompletePushTest’ failed.The exception thrown was ‘Microsoft.SharePoint.SPException’ : ‘Failed to create package file.’" Time="2008-01-29T13:40:49.9387732Z" Severity="Error" Description="" Recommendation="" Phase="Failure" />

     </ArrayOfReportMessage>

    Here is the scenario:

    I have just completed installing wss service pack 1, and MOSS 2007. The replication now gives the error above. My topology is as follows: I have two farms located in different located geographically. It was working before. This is a full-deployment not incremental.

    please help

  26. Hi Bramley,

    please open a support case for this. This is not an issue I have heard about till now.

    Cheers,

    Stefan

  27. Bramley says:

    Hi Stefan

    Do you think this has any thing to do with compression of files. How can I remove compression. I’m using MOSS – Central Administration for content deployment. This issue affect the increment updates. I get the following error for incremental:

    <?xml version="1.0" encoding="utf-8" ?>

    – <ArrayOfReportMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;

     <ReportMessage Title="The changeToken refers to a time before the start of the current change log." Time="2008-01-29T20:39:04.6175572Z" Severity="Error" ObjectName="/" Phase="ExportInProgress" />

     <ReportMessage Title="The changeToken refers to a time before the start of the current change log. at Microsoft.SharePoint.Deployment.SPExport.ThrowInvalidChangeTokenError(DateTime minChangeTime, Int32 minChangeNumber) at Microsoft.SharePoint.Deployment.SPExport.GetIncrementalChanges() at Microsoft.SharePoint.Deployment.SPExport.CalculateObjectsToExport() at Microsoft.SharePoint.Deployment.SPExport.Run()" Time="2008-01-29T20:39:04.8363044Z" Severity="Error" Phase="ExportInProgress" />

     <ReportMessage Title="Content deployment job ‘NewCompletePushTest’ failed.The exception thrown was ‘Microsoft.SharePoint.SPException’ : ‘The changeToken refers to a time before the start of the current change log.’" Time="2008-01-29T20:39:05.8362916Z" Severity="Error" Description="" Recommendation="" Phase="Failure" />

     </ArrayOfReportMessage>

    Any help will do.

  28. Hi Bramley,

    sure it is related to compression. The error message implies this.

    The error for the incremental deployment indicates that your database is older than the last deployment.

    This can happen if you have restored an older backup of the database. Then the deployment job definition does no longer fit to the source database.

    Cheers,

    Stefan

  29. Anonymous says:

    在使用SharePoint的时候我们常常需要做这样一个操作:把某个列表(或文档库)从一个网站转移到另一个网站上去。

    比较常见的做法是,把这个列表存为模板文件,然后再在新的网站位置创建一遍。但这种方法…

  30. Anonymous says:

    Stefan Goßner posted a great series of posts about the Content Migration API (formerly known as PRIME

  31. Anonymous says:

    I&#39;m happy to announce that development/testing of the next version of the SharePoint Content Deployment

  32. Ramesh says:

    Hi

    I’ve a big problem in the stsadm -restore command

    We only had Site collection backups and we need one site the user deleted from the backup

    We did the backup in the production server and one of the user deleted the site(:)) and we’re trying to get the site backup.

    When we try to restore we’re getting the following error

    C:Documents and Settingsrameshk>stsadm -o restore -url http://localhost -filename z:projects.bak -overwrite

    Your backup is from a different version of Windows SharePoint Services and cannot be restored to a server running the current version. The backup file should be restored to a server with version ‘3701403.0.1196032409.29915337’ or later.

    I saw few post on this error.

    http://blogs.technet.com/wbaer/archive/2007/05/22/understanding-and-handling-microsoft-it-site-delete-capture-1-0-archives.aspx – I did install the MSITDelete Site capture on my local machine. Not sure that is the problem. If only have installed this the production, that would have saved almost two days and still no postive results

    http://serverdays.com/2007/08/10/problems-using-stsadm-to-backup-windows-sharepoint-services-30/

    But not any solutions though. I don’t know whether Microsoft knows about this or something I’m not doing correctly.

    And by the way, if I have backup using stsadm can I read it using Content API or any other tool which wil read the data and restore it

    Any help will be greatly appreciated.

    Thanks

    Ramesh

  33. Hi Ramesh,

    this message means that the backup has been taken using SQL methods – not using STSADM -o backup.

    You need to restore it using SQL methods. You cannot restore a SQL backup with STSADM.

    Cheers,

    Stefan

  34. Vedanshu says:

    Hi,

    I am using Microsoft.Sharepoint.Deployment classes to create archives of sites using the code mentioned below. It used to work previously, but has started throwing the following exception

    Failed to create package file

    Unknown compression type in a cabinet folder

    at Microsoft.SharePoint.Library.SPRequest.BuildCabinetFile(String bstrTempDirectory, String bstrCabFileLocation, UInt32 uMaxCabFileSize) at Microsoft.SharePoint.Deployment.ExportDataFileManager.<>c__DisplayClass2.<Compress>b__0()

    Here’s the code that I am using

    SPSecurity.RunWithElevatedPrivileges(delegate()

                   {

                       using (SPSite site = new SPSite(url))

                       {

                           using (SPWeb web = site.OpenWeb())

                           {

                               string strBackupfile = web.Title + ".cmp";

                               SPExportSettings exportSettings = new SPExportSettings();

                               if (ExportAll)

                                   exportSettings.ExportMethod = SPExportMethodType.ExportAll;

                               else

                                   exportSettings.ExportMethod = SPExportMethodType.ExportChanges;

                               exportSettings.BaseFileName = strBackupfile;

                               exportSettings.FileLocation = "C:\";

                               exportSettings.ExcludeDependencies = false;

                               exportSettings.IncludeSecurity = SPIncludeSecurity.All;

                               if (IncludeAllVersions)

                                   exportSettings.IncludeVersions = SPIncludeVersions.All;

                               else

                                   exportSettings.IncludeVersions = SPIncludeVersions.CurrentVersion;

                               exportSettings.SiteUrl = url;

                               exportSettings.ExcludeDependencies = false;

                               exportSettings.CommandLineVerbose = false;

                               exportSettings.FileCompression = true;

                               exportSettings.OverwriteExistingDataFile = true;

                               SPExportObject ob = new SPExportObject();

                               ob.Type = SPDeploymentObjectType.Web;

                               ob.ExcludeChildren = false;

                               ob.Id = web.ID;

                               exportSettings.ExportObjects.Add(ob);

                               exportSettings.Validate();

                               SPExport export = new SPExport(exportSettings);

                               //export.Completed += new EventHandler<SPDeploymentEventArgs>(export_Completed);

                               //Run the damn thing.

                               export.Run();

                               //context.Undo();

                           }

                       }

                   });

    This works correctly if I set exportSettings.FileCompression to false. I have recently installed WSS and MOSS service packs. Can you please help me out?

    Thanks

    Vedanshu

  35. Hi Vedanshu,

    this is a common error if the compression fails due to insufficient disk space.

    Please monitor the available disk space during export.

    Cheers,

    Stefan

  36. Vedanshu says:

    Hi Stefan,

    I am running this process on a test site which is just a basic collaboration portal. The process used to work fine before we installed Sharepoint service packs. During those test runs, the size of archives created was less than 10MB with the available disk space being close to 22GB. So I guess disk space should not have  been a problem. I have also tried it with different filetypes (.cmp, .cab etc.)but have not been able to run it with compression enabled. The process works correctly if exportsettings.FileCompression is set to false.

    Thanks

    Vedanshu

  37. Hi Vedanshu,

    please monitor the space on ALL your disks – not only the destiation disk where the final package should be created.

    During export the files are temporarily created on the drive where the TMP environment variable points to.

    Cheers,

    Stefan

  38. Anonymous says:

    [ Part 1 – Part 2 – Part 3 – Part 4 – Part 5 – Part 6 ] Requirements for a successful content deployment

  39. akhanna says:

    Hi Stefan,

    I have a timer job running which uses export settings class and creates a content package for all the items in a document library.

    Now users upload files in this document library and I want only the approved items should be exported.

    If I SPIncludeVersions.LastMajor , and I have anything where approval status is pending, I get the error message that

    The object with Id<Guid)  that was configured as part of the Export Settings no longer exists.

    If I change SPIncludeVersions.CurrentVersion then it exports all items even if the approval status is pending.

    what do I need to do that people can upload to this list and only documents with status of approved are exported.

    Thanks In Advance.

    Cheers

    Ajay

  40. Hi Akhanna,

    the error should not occur. Please open a support case to get this problem analyzed.

    Thanks,

    Stefan

  41. Anonymous says:

    Fantastic article on WSS content migration / MOSS content deployment API

  42. Anonymous says:

    If you&#39;ve been under a rock like I have apparently over the last few months, you might not have noticed

  43. Kieran says:

    Hi Stefan

    Would you suggest using SharePoint content deployment to move new sites/sub-sites and content types created by users from their local virtual development environment?

    Best Regards

  44. Hi Kieran,

    sites and sub-sites: yes

    Content types: no. These should be deployed using custom features. Not using content deployment.

    Cheers,

    Stefan

  45. jinzhuli says:

    Hi Stefan

    I have a problem when i use Export to Backup a Web . Error Message: Failed to backup the web. Reason: Export ran out of memory while compressing a very large file. To successfully export, turn compression off by specifying the -nofilecompression parameter.

    Thanks

    jinzhuli

  46. Hi Jinzhuli,

    the solution is clear: either go to a 64-bit environment where no similar memory limitations exist or use the parameter above to disable compression.

    Cheers,

    Stefan

  47. Anonymous says:

    As a follow up to my article series about the content deployment and migration API here are some tips

  48. Anonymous says:

    SharePoint Site vs. Web exports/imports and Custom Layout Pages

  49. Anonymous says:

    Body: If you are deploying SharePoint you should take some time and read the following WSS/MOSS Content

  50. Timothy says:

    Can someone explain the difference between ExcludeChildren and IncludeDescendants?

    Thanks

  51. Hi Timothy,

    I have explained this in part 2.

    Cheers,

    Stefan

  52. Ajay Khanna says:

    Hi Stefan,

    I just read on a blog that Sharepoint designer workflows do not get migrated by Content Deployment… is this true?

    Please advise/confirm…

    Thanks

    Ajay

  53. Hi Ajay,

    content deployment deploys content. Not other things. Workflows should in general be deployed using features. With SPD workflows you might have to recreate the workflow on the target if really required.

    As content should only be changed on the source and not on the target to ensure that content deployment works reliable might not make sense on the target anyway as workflows are used when content gets changed.

    Cheers,

    Stefan

  54. Rahul Singh says:

    Hi,

    I am using the content migration API to import and export large video files (50-500 MB).

    I am getting following error when one of the larger files around 300 MB are being attached : "Insufficient memory to continue the execution of the program. at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem"

    I have 2GB ram and x86 processor. This problem only occurs on 32 bit processors. Its working fine with x64 architecture.

    I am using an external blog storage API to store these large files.

    Please advise!!

    Regards,

    Rahul Singh

  55. Hi Rahul,

    are you doing this in a console application or in a web application?

    In general it sounds like a design limitation. MOSS loads all items into memory before writing to the it to the database. Content deployment and migration API has a large memory footprint itself. With so large objects it might be that the 2 GB virtual memory per process (800 MB for ASP.NET application) is not sufficient. 64-bit is then the solution to go.

    Cheers,

    Stefan

  56. shobha says:

    Hi

    I m getting this error  :

    Progress: Importing ListItem /sites/components/MigratedUD?id=46.

    [11/12/2008 10:56:41 AM]: Error: Invalid file name

    The file name you specified could not be used.  It may be the name of an existing file or directory, or you may not have permission to access the file.

      at Microsoft.SharePoint.Library.SPRequest.CreateOrUpdateFileAndItem(String bstrUrl, String bstrWebRelativeUrl, Guid& docId, Object varDoc, Int32 docLength, Int32 exists, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Int32 iVersion, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String checkInComment, Int32 docLibRowID, String bstrListName, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage)

      at Microsoft.SharePoint.Deployment.FileSerializer.CreateOrUpdateFileWithGuid(SPFileStream spstm, SPWeb web, Guid fileId, String fileUrl, SPUser author, SPUser editor, String checkinComment, DateTime timeCreated, DateTime timeLastModified, MetaInfoHandler metaInfo, FileInfo fileInfo, Int32 iVersion, Boolean isFirstVersion, SPImportSettings settings, Int32 listItemId, String listInternalName)

    Thanks in advance

    Shobha

  57. Hi Shobha,

    you are trying to import into a not empty database. An item with the same name but with different GUID is already in the database and that causes the problem.

    Cheers,

    Stefan

  58. Intekhab says:

    how could we migrate list without list item?

    How could we migrate list item version(list items are not files)?

  59. Hi Intekhab,

    you need to deploy the SPList object without Decendents.

    For the list items with version you need to pick each SPList item separately and set SPExportSettings.IncludeVersions according to your needs.

    Cheers,

    Stefan

  60. Intekhab says:

    hi Stefan,

    when i am exporting list items, in which one is folder and under this folder there is list item.

    i am getting this error

    FatalError: Violation of PRIMARY KEY constraint ‘PK__#ExportObjects____124F33FC’

    . Cannot insert duplicate key in object ‘dbo.#ExportObjects’.

    The statement has been terminated.

    Regards

    Intekhab

  61. Hi Intekhab,

    a fix for this has been released a year ago or so.

    Please ensure to have SP1 + December Cumulative Update for WSS and MOSS installed.

    Cheers,

    Stefan

  62. Varun says:

    Hi,

    I am using the content migration API along with retain ID’s to handle list’s along with attachments.

    I am exporting lot of list items together, Is there any way that i can perform some operations on these items just before importing using Content migration API by only using the export file.

    I tried using the Started event handler with the API but it didn’t work, I am looking for an event handler like ObjectImporting which will be called just before an object is about to be imported.

    Please suggest!

    Regards

    Varun

  63. Hi Varun,

    afaik that cannot be done when using the option to retains object identity.

    Cheers,

    Stefan

  64. Anonymous says:

    Following are some of the things that I learned while doing the content deployment for one of my customers:

  65. Sunil says:

    Hello Stefan,

    Just wanted to know "Does SPExport support multiple parallel jobs?" In other words is this class thread safe?

  66. Hi Sunil,

    it is not a matter of this object. WSS itself does not properly handle parallel execution of multiple export operations for the same database.

    With other words: as long as the source databases are different you can execute them in parallel. But if the export should be for the same database you need to serialize them to avoid random errors.

    Cheers,

    Stefan

  67. Lili Wei says:

    Hi Stefan,

    When we try to Export/Import a root site collection from one web application to another on the same server, the export task is finished successfully but when import the .cmp file, error happens:

    [3/18/2009 9:42:10 AM]: Progress: Importing List List Template Gallery.

    [3/18/2009 9:42:11 AM]: Progress: Importing List Master Page Gallery.

    [3/18/2009 9:42:12 AM]: FatalError: Value does not fall within the expected range.

      at Microsoft.SharePoint.SPFileCollection.get_Item(String urlOfFile)

      at Microsoft.SharePoint.SPContentTypeCollection.Add(SPContentType contentType)

      at Microsoft.SharePoint.Deployment.ContentTypeSerializer.CreateContentType(SPContentType sourceContentType)

    Any ideas? Thanks a lot.

  68. Hi Lili,

    please open a support case with Microsoft to get this analyzed.

    Cheers,

    Stefan

  69. Lili Wei says:

    Hi Stefan,

    We encounter another error when import a root site collection from source server to destination server. Here’s error message:

    [4/2/2009 4:58:27 PM]: Start Time: 4/2/2009 4:58:27 PM.

    [4/2/2009 4:58:27 PM]: Progress: Initializing Import.

    [4/2/2009 4:58:32 PM]: FatalError: Could not find Feature DataConnectionLibrary.

      at Microsoft.SharePoint.Deployment.ImportRequirementsManager.VerifyFeatureDefinition(SPRequirementObject reqObj)

      at Microsoft.SharePoint.Deployment.ImportRequirementsManager.Validate(SPRequirementObject reqObj)

      at Microsoft.SharePoint.Deployment.ImportRequirementsManager.DeserializeAndValidate()

      at Microsoft.SharePoint.Deployment.SPImport.VerifyRequirements()

      at Microsoft.SharePoint.Deployment.SPImport.Run()

    [4/2/2009 4:58:33 PM]: Progress: Import Completed.

    [4/2/2009 4:58:33 PM]: Finish Time: 4/2/2009 4:58:33 PM.

    [4/2/2009 4:58:33 PM]: Completed with 0 warnings.

    [4/2/2009 4:58:33 PM]: Completed with 1 errors.

    We checked that the folder "DataConnectionLibrary" existed under C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions12TEMPLATEFEATURES on destination server. I find out the solution on internet, which is to deactive the "DataConnectionLibrary" feature before export by command "stsadm -o deactivatefeature -name DataConnectionLibrary -url http://weburl -force

    ". Is there any better way to fix it? Thanks a lot.

    Best regards,

    Lili Wei

  70. Hi Lili,

    just having the folder does not mean that the feature is installed.

    You need to run STSADM -o installfeature … to install the feature after copying the files to the folder.

    Cheers,

    Stefan

  71. Anand says:

    Hi Stefan,

    Is it possible to create a new page in production server with site collection administrator permission.

    I am facing this problem. I sucessfully created a new site but if i want to create a new page then it is redirecting to access denied page.(I am having site collection admin permission This production collection is in different box and it is deployed through content deployment job).

    Regards

    Anand

  72. Hi Anand,

    this sounds like a known issue that was fixed in the February CU.

    Cheers,

    Stefan

  73. Anand says:

    Thanks for your reply Stefan,

    Can you give more details abouts this February CU. Do we need to run any service packs to fix this issue. Please suggest me.

    Regards

    Anand

  74. Hi Anand,

    Service Pack 1 + the February CU will be required.

    In addition some steps are required to fix your existing database.

    So please open a support Case with Microsoft to get the tools to fix this.

    Cheers,

    Stefan

  75. Intekhab says:

    Hi Stefan,

    Can we change any file(.aspx page) at the time of importing?

    In which event we have to anchor our code?

  76. Intekhab says:

    Not importing, at the time of exporting.

  77. Hi Intekhab,

    intersting question! Not directly on export – but afterwards.

    During export you could register to the following event to achieve what you are looking for:

    export.Compressing: here you can see the exported content before it is compressed into the cab file in a flat directory and are able to manipulate them (you would have to check in the manifest file which of the binaries relates to which file as the name changes. e.TempDirectoryPath will contain the directory that holds all the data.

    Cheers,

    Stefan

  78. Intekhab says:

    Hi Stefan,

    These list items are the hook in my neck. When i am migrating the site all the list items get duplicated each time.i know that this is the default behaviour of CMP API but is there any way to get rid while migrating the site? Please suggest something…

    I googled for the same but all in vain

    Regards

    Intekhab

  79. Hi Intekhab,

    this is by design if RetainObjectIdentity is false.

    Setting this to true will avoid this problem.

    Cheers,

    Stefan

  80. Anand says:

    Hi Stefan,

    This question is not related to content deployment issue, but i want to know if we modify any oob forms(eg: Workflow.aspx in 12 hive) and if we install service pack or patchs then what ever we have modified to the workflow.aspx will remain same or a new form will replace the older one. Please suggest me regarding this

    Regards

    Srivatsa

  81. Hi Srivatsa,

    modifying these files is unsupported.

    Hotfixes and service packs could overwrite these files – or even worth: in some situations might not update the files which would mean that you end up with a mix of patches.

    Before installing a fix you have to replace all modified files with the original version and then replace the fix to ensure that the hotfix installer can create a supported state.

    Cheers,

    Stefan

  82. Anonymous says:

    SharePoint tiene un API para migrar contenido efectivo y poderoso.&#160; Dentro del ensamblado Microsoft

  83. Srivatsa says:

    Hi Stefan,

    I have two site collection, one is autuoring site and a production site and I am running content deployment job from authoring to production.

    The question I activate one of the OOB feature at the site collection and run the content deployment job to a blank site collection. At that time it will activate all the features which are activated in the souce site.

    After that i will deactivate one of the feature and run the content deployment job then deactivated feature wont be deactivated at the destination site. It will show the status as activated only.

    How can we avoid this?

    Regards

    Sri

  84. Hi Sri,

    this cannot be prevented. It is by design. Content deployment does not explicit feature deactivation. It only activates features on site level that are activated when the site is provisioned.

    If features need to be deactivated on the target you have to do this manually or using a script.

    Cheers,

    Stefan

  85. Sri says:

    Hi Stefan,

    We are moving mcms application to Moss 2007 and it went sucessfully, but the problem is web parts are not displaying properly. All web parts are coming one below the other instead of one beside the other.I am guessing this is related to page layouts only. Just i wanted to know whether this migration does not support the page layouts.

    Regards

    sri

  86. Hi Sri,

    the template code is not migrated. A page layout is automatically generated for each template definition.

    You need to adjust the page layouts to your needs afterwards manually.

    Cheers,

    Stefan

  87. Sara Tenenbaum says:

    Hi Stefan,

    Do content types transfer over together with the rest of the site? (You mentioned needing a feature, but these are just part of the regular content type list). Is there a way to retain the GUIDs of the lists?

    Thanks so much

    Sara

  88. Hi Sara,

    yes, content types are transferred.

    to retain the guid use RetainObjectIdentity as discussed in part 3.

    Cheers,

    Stefan

  89. Sara Tenenbaum says:

    Hi again,

    Thanks for the extra quick reply! and for a fantastic group of posts. This is one part of SharePoint that I am looking forward when it matures. I am transferring a site with some nice XSL and hopefully this will help.

    Best,

    Sara

  90. Vedanshu Mandvikar says:

    Hi Stefan,

    Can I import a CMP file created on a 32 bit SharePoint server installation on a 64 bit SharePoint installation.

    Thanks

    Vedanshu

  91. Hi Vedanshu,

    yes this is possible.

    Cheers,

    STefan

  92. Ashish T says:

    Hi Stefan,

    I have variation site structure as VariationRootsite then english and french site in parallen with in the same web application. I have a list say EnglishTest in english and want to move the list items from to EnglishTest list french site FrenchTest List. both lists has same template. I want to move list items from english site to french site. We want to retain object identity so that during next export-import operation the if any item in the english site being updated then it will reflect the update on the same item in french site also. Help is appriciated.

    Thanks.

  93. Hi Ashish,

    variation ensures that if an item updated in the source label gets sync’ed with the items in the target.

    You don’t have to bother about this.

    As the items in the different labels have different URLs it is impossible to use RetainObjectIdentity here.

    Moss deals with this by using a relationship list which binds source items to target items.

    Cheers,

    Stefan

  94. Ashish T says:

    Hi Stefan, Thanks for the reply.

    We have one more case. We have two site collection s in the same web application in same language. We want to keep few lists of SiteCollection2 in sync with the same lists of Sitecollection1. We want to migrate list items only using content migration APIs. we want to update the items also when they got updated in SiteCollection1. could you guide us how to get the same?

    Thanks a lot.

  95. Hi Ashish,

    updating items only works reliable when using RetainObjectIdentity.

    Using this options has two limitations:

    1) both site collections need to reside in different content databases

    2) the site collection relative URL needs to be identical.

    So if this can be accomplished it will work.

    If not you would have to implement your own sync mechanism without using this API.

    btw: why would you like to have the same data in two site collections?

    You should be able to access the lists from a different site collection in your site as well.

    Cheers,

    Stefan

  96. Hafriz says:

    Hi Stefan, I have this irritating error:

    The connection to the destination server was lost after the remote import job was started. The import job might still succeed. Content deployment will continue to attempt to reestablish a connection with the destination server

    What could be the cause of this error? Both servers are in the same zone, and are hosting the same site. The source server is basically our authoring server while the destination is production end. I have deleted this job and path and recreated but i keep getting the same error.

    Appreciate ur help in advance.

  97. Hi Hafriz,

    sounds like a network problem.

    Please check if you can see and problems in the IIS log of the target central admin site.

    Cheers,

    Stefan

  98. Phong says:

    I am also getting this error with the content deployment:

    The connection to the destination server was lost after the remote import job was started. The import job might still succeed. Content deployment will continue to attempt to reestablish a connection with the destination server.

    It’s stuck on "Running" for over 3 days now.  It doesn’t give me the option to stop it or delete it.  How do I get rid of it?

    Thanks in advance!

  99. Hi Phong,

    if it is stuck on importing you can resolve this using the following steps:

    1) navigate to http://central-admin-url/lists/content%20deployment%20jobs

    2) edit the list item with the same name as the stuck job

    3) change the value of the "LastStatus" field to "13"

    4) navigate back to the content deployment paths and jobs page and you should have the option "Check Status" again.

    5) do the check status and you will see if the job has succeeded or failed.

    Cheers,

    Stefan

  100. Torben RImmer says:

    Hi Stefan

    I have the following error on Contend deploy

    The list item cant be deleted becourse the collection do not exist.

    This happens if a user creats a list and before the deploymentjog is running the user then delete thislist again.

    2. Senario is that if a user delete a pages and the rename the site, before the deployjob is running.

    I both cases the dployjob fails becource the page cant be deleted becource the destanation is not there.

    Haw can u force a full deploy, that overright thise errors ?  

  101. Hi Torben,

    please verify if this happens if you have MOSS 2007 with SP2 and December 2009 CU installed.

    If yes, you should open a support case to get this addressed.

    Cheers,

    Stefan

  102. Mehul Jamod says:

    Hi Stefan,

    I am trying to Moving Pages inside PageLibrary from one location to another location using SPExport/SPImport  as i want all metadata information (Last Modified date, created date, modified by etc..) to be as it is

    I am using below code..

    For Exporting list item..

           SPExportSettings exportSettings = new SPExportSettings();

               exportSettings.AutoGenerateDataFileName = true;

               exportSettings.ExportMethod = SPExportMethodType.ExportAll;

               exportSettings.SiteUrl = siteURL;

               exportSettings.IncludeSecurity = SPIncludeSecurity.None;

               exportSettings.IncludeVersions = SPIncludeVersions.All;

               exportSettings.OverwriteExistingDataFile = true;

               exportSettings.CommandLineVerbose = false;

               SPExportObject exportObject = new SPExportObject();

               exportObject.Id = li.UniqueId;

               exportObject.ExcludeChildren = true;

               exportObject.IncludeDescendants = SPIncludeDescendants.Content;

               exportObject.Type = SPDeploymentObjectType.ListItem;

               exportSettings.ExportObjects.Add(exportObject);

               Trace.WriteLine("Starting export of URL : " + siteURL);

               using (SPExport export = new Microsoft.SharePoint.Deployment.SPExport(exportSettings))

               {

                   export.Run();

               }

    For Importing ListItem…

           SPImportSettings importSettings = new SPImportSettings();

               importSettings.BaseFileName = System.IO.Path.GetFileName(fileToImport);

               importSettings.FileLocation = System.IO.Path.GetDirectoryName(fileToImport);

               importSettings.SiteUrl = siteURL;          

               importSettings.RetainObjectIdentity = false;        

               importSettings.IncludeSecurity = SPIncludeSecurity.None;

               importSettings.UpdateVersions = SPUpdateVersions.Ignore;

               importSettings.UserInfoDateTime = SPImportUserInfoDateTimeOption.ImportAll;

               importSettings.CommandLineVerbose = false;

               Trace.WriteLine("Starting import to URL : " + siteURL);

               using (SPImport import = new SPImport(importSettings))

               {

                   import.Started += new EventHandler<SPDeploymentEventArgs>(import_Started);          

                   import.Run();

               }

    It’s working fine and keeping metadata information only if page is having more then one version. If page is having only one version (major or minior) then it’s changing modified date to current date.

    do i missing any settings ? or is it a limitation of MOSS 2007 ?

    Anybody has face this kind of issue ?

    Thanks,

    Mehul

  103. Hi Mehul,

    sounds to me as if you don’t have the latest hotfixes installed. A similar issue was in October CU.

    Cheers,

    Stefan

  104. Lakshman.R says:

    We had installed the Moss 2007 Cummulative updates for December 2009 last month.

    Few Days before we found out that Content deployment jobs scheduled on our Farm are not running. When we start this content deployment jobs manually, it remains in the status – “Preparing”

    Any inputs from your side

    Regards,

    Lakshman

  105. Hi Lakshman,

    that is not a known issue.

    I would suggest to test April 2010 CU which was released this week and if the problem persist to open a support case with Microsoft.

    Cheers,

    Stefan

  106. Stormbringer says:

    I understand that the Move/Copy action in the Site Content and Structure tool uses the content migration API. This means that when I move a page it's actually doing a content migration from one Pages list to another. We have a situation whereby if there are no variations in a site collection, or a single source variation, an authenticated user can move or copy a page provided they have Manage Permissions enabled in their profile. However, if the same user attempts to move/copy a page when there is a source variation and one or more target variations, they get the following error:

    <error><message>Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))</message>

       <full>Microsoft.SharePoint.SPException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) —> System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex) at Microsoft.SharePoint.Deployment.SPExport.Run() at Microsoft.SharePoint.Publishing.Internal.DeploymentWrapper.MoveItems(String[] sourceSmtObjectIds, String destSmtObjectId) — End of inner exception stack trace — at Microsoft.SharePoint.Publishing.Internal.DeploymentWrapper.MoveItems(String[] sourceSmtObjectIds, String destSmtObjectId) at Microsoft.SharePoint.Publishing.Internal.WebControls.MoveItems.Copy()</full>

       <customData>Operation to Move 'atestpage.aspx' to '/internet/can/en/home/Pages' Failed</customData></error>

    Only a site collection administrator can move/copy pages when there are one or more target variations. I could understand it if it failed for the first scenario, i.e. needing a certain level of permissions in order to move/copy a page at all using the API, but it seems crazy to have one scenario work and another fail.

  107. Stormbringer says:

    I understand that the Move/Copy action in the Site Content and Structure tool uses the content migration API. This means that when I move a page it's actually doing a content migration from one Pages list to another. We have a situation whereby if there are no variations in a site collection, or a single source variation, an authenticated user can move or copy a page provided they have Manage Permissions enabled in their profile. However, if the same user attempts to move/copy a page when there is a source variation and one or more target variations, they get the following error:

    <error><message>Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))</message>

       <full>Microsoft.SharePoint.SPException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) —> System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex) at Microsoft.SharePoint.Deployment.SPExport.Run() at Microsoft.SharePoint.Publishing.Internal.DeploymentWrapper.MoveItems(String[] sourceSmtObjectIds, String destSmtObjectId) — End of inner exception stack trace — at Microsoft.SharePoint.Publishing.Internal.DeploymentWrapper.MoveItems(String[] sourceSmtObjectIds, String destSmtObjectId) at Microsoft.SharePoint.Publishing.Internal.WebControls.MoveItems.Copy()</full>

       <customData>Operation to Move 'atestpage.aspx' to '/internet/can/en/home/Pages' Failed</customData></error>

    Only a site collection administrator can move/copy pages when there are one or more target variations. I could understand it if it failed for the first scenario, i.e. needing a certain level of permissions in order to move/copy a page at all using the API, but it seems crazy to have one scenario work and another fail.

  108. Hi Stormbringer, I just tested the scenario and found the same when trying to copy. The problem seems to occur when resolving content type dependencies. You might want to open a support case if you need to export the items with a user less than site collection administrator.

  109. Frankie says:

    Dear Stefan,

    I just sent email to you yesterday, not sure you have received the email. So I would like to post it in here to you.  Currently, we met content import error about "Import failed:Microsoft.SharePoint.SPException: Cannot import version 4.0 because only version 3.0 was exported". I doubt the root cause is user publish content update during the exporting job running. Not sure if it's a bug for MOSS, would like to seek your help on how to prevent such error. Many thanks!

  110. Hi Frankie,

    looks as if the export was done from SharePoint 2007 and the import was tried on SharePoint 2010. That is not supported.

    You cannot export/import cross version.

    Cheers,

    Stefan

  111. AbdulAjees says:

    We are going implement content deployment job in SharePoint 2013 site. We don’t have separate STAGING environment for act as a source of the content deployment.

    My Proposal design is EX: A,B and C are my web applications. Webapp-A (Test site) and Webapp-B(Staging) in both are same farm. Staging will be act as a source of content deployment
    WebApp C is Production and act as destination of content deployment.
    We have custom code to deploy web application level and only one feature at FARM level.

    Will content deployment job work without fail ? if we deploy and activate the new feature only in Webapp-A not in Webapp-B since both are in same FARM.
    We have around 2000 pages in PROD. Can we continue with existing site or content deployment will work only for empty template for first moving from source to destination?

  112. Pradeep says:

    Is there any limitation while using stsadm command import/export. Like if custom role/groups are used will that also get exported/imported to the new subsite location. I am getting "FatalError: The given key was not present in the dictionary.

    at System.ThrowHelper.ThrowKeyNotFoundException() " error in import log while importing. Is there any workaround or location to look at to find a fix this issue.

    Thanks & Regards

  113. Hi Pradeep,
    there are no known limitations in this area.
    The description sounds more like a db inconsistency.
    Cheers,
    Stefan