1
Vote

Export import problems:

description

Actually no error during import of export has been happened, but
after importing of some lists they shows twice time in "admin side [site libryries and lists]".
of some list views shows double time "top menu bar",
or lists shows doble or more time same content (not uniq)
 
but i have seen much less usefull tool...
thanks for that :)

file attachments

comments

nocher wrote Nov 13, 2009 at 9:18 AM

we have tried to find a way /solution.
in result has been found that: "default views" for all list described double time in the manifest document.
to fix this we have modified code (one extra method has been added) :
--DoubleDefaultViewsFix
and code to execute this method:
public static void Execute(SPSWebApplication app, string packDirectory)
    {
        XmlDocument doc = new XmlDocument();
        doc.Load(packDirectory + "\\manifest.xml");

        NonExportedItemsFix(doc, app);
        //fix problem with double time [default views]
        DoubleDefaultViewsFix(doc, app);
        doc.Save(packDirectory + "\\manifest.xml");
    }
private static void DoubleDefaultViewsFix(XmlDocument doc, SPSWebApplication app)
    {
        XmlNamespaceManager mgr = new XmlNamespaceManager(doc.NameTable);
        mgr.AddNamespace("a", doc.DocumentElement.NamespaceURI);

        List<XmlNode> markDeleted = new List<XmlNode>();

        XmlNodeList listdNodes =doc.DocumentElement.SelectNodes("/*/*[name()='SPObject']/*[name()='List']");

        foreach (XmlElement  listNode in listdNodes){
                List<Guid> vs = new List<Guid>();
                Logger.WriteLine("Fixing List:" + listNode.GetAttribute("Title"));
                foreach (XmlElement viewNode in listNode.SelectNodes("*[name()='Views']/*[name()='View']"))
                {
                    Logger.WriteLine("Fixing view:" + viewNode.GetAttribute("Url") + "; id=" + viewNode.GetAttribute("Name"));
                    Guid g=new Guid(viewNode.GetAttribute("Name"));
                    if (vs.Contains(g))
                    {
                        markDeleted.Add(viewNode);
                        Logger.WriteLine("founded duplicates!");
                    }
                    else vs.Add(g);
                }        
        }

        foreach (XmlElement node in markDeleted)
            if (node.ParentNode != null)
            {
                Logger.WriteLine("Fix manifest, deleting duplicate view: " + node.GetAttribute("Url"));
                node.ParentNode.RemoveChild(node);
            }
    }

wrote Nov 13, 2009 at 9:18 AM

wrote Feb 13, 2013 at 5:40 PM