Unanswered How to migrate External data Column from SP2007 to SP2010 ?

  • Wednesday, August 08, 2012 1:37 PM
     
      Has Code

    Hi,

    I am migrating a custom list from SP 2007 to SP2010 which contains a External data column. I have followed DB attach approach for migration process.

    I have created a BDC Project (External Content type) using VS2010. After migration the external data column(Col07) doesn't work so I have planned to create a new external data column(Col10) and delete the old column(Col07) but if i delete the data will lost from the list, I copy the external data column(Col07) from the list to the newly created external data column(Col10)via code. Here is the sample code

    foreach (SPListItem objItem in objList.Items)
    {
      //get the values from old Bdc Column
      string sOldBDCValue = objItem["OldBdcCol"].ToString();
      string sContentValue = objItem["OldBdcCol: CONTENT"].ToString();
    
      SPField bdcField = objItem.Fields["OldBdcCol"];
      XmlDocument xmlData = new XmlDocument();
      xmlData.LoadXml(bdcField.SchemaXml);
      string sEntityName = xmlData.FirstChild.Attributes["RelatedFieldWssStaticName"].Value;
      string key = objItem[sEntityName].ToString();
      objItem[sEntityName] = EntityInstanceIdEncoder.EncodeEntityInstanceId(new object[] { key });                           
      objItem[bdcField.Title] = key.ToString();
    
      //Updating values to the new BDC Col
      objItem["OldBdcCol"] = key.ToString();
      objItem["OldBdcCol: CONTENT"] = sContentValue;
      objItem.Update();
      objList.Update();  
    }

    After updating the new Bdc column and additional fields I am able to persist the values in the additional fields of the list except the bdc column.

    Could anyone help me to resolve the issue or any other approach to resolve it ?

    Regards

    Ramalingam.S

    • Edited by SRVK Wednesday, August 08, 2012 1:37 PM
    •