private float iInstallNavigationItem(SPNavigationNodeCollection navNode, XmlNodeList ndParentItems, int ParentMessageId, XmlNode docFiles, float counter, float max, string navField, SPListItem oParentListItem, ref ArrayList arrNavNodes) { var iArrNodes = new ArrayList(); foreach (XmlNode nd in ndParentItems) { var sParentName = ApplicationInstallerHelpers.getAttribute(nd, "Name"); var sParentUrl = GetCleanUrl(ApplicationInstallerHelpers.getAttribute(nd, "Url")); var bParentExternal = false; bool.TryParse(ApplicationInstallerHelpers.getAttribute(nd, "External"), out bParentExternal); var bAppend = false; bool.TryParse(ApplicationInstallerHelpers.getAttribute(nd, "Append"), out bAppend); if (bParentExternal || DoesLocationExist(sParentUrl, ApplicationInstallerHelpers.getAttribute(nd, "Url"), ApplicationInstallerHelpers.getAttribute(nd, "List"), docFiles)) { var ndChildItems = nd.SelectNodes("Item"); try { SPNavigationNode oNewNav = null; if (!bVerifyOnly) { oNewNav = ApplicationInstallerHelpers.GetNavNode(navNode, navField, sParentName, oParentListItem); } if (!bVerifyOnly && oNewNav == null) { oNewNav = new SPNavigationNode(sParentName, sParentUrl, bParentExternal); navNode.AddAsLast(oNewNav); iArrNodes.Add(oNewNav.Id.ToString()); arrNavNodes.Add(oNewNav.Id + (iCommunity != 0 ? ":" + appDef.Id : string.Empty)); } var ParentNavMessageId = addMessage(ErrorLevels.NoError, sParentName, string.Empty, ParentMessageId); foreach (XmlNode ndChild in nd.SelectNodes("Item")) { var sChildName = ApplicationInstallerHelpers.getAttribute(ndChild, "Name"); try { var sChildUrl = GetCleanUrl(ApplicationInstallerHelpers.getAttribute(ndChild, "Url")); var bChildExternal = false; bool.TryParse(ApplicationInstallerHelpers.getAttribute(ndChild, "External"), out bChildExternal); if (bChildExternal || DoesLocationExist(sChildUrl, ApplicationInstallerHelpers.getAttribute(ndChild, "Url"), ApplicationInstallerHelpers.getAttribute(ndChild, "List"), docFiles)) { if (oNewNav != null) { var oNewChildNav = new SPNavigationNode(sChildName, GetCleanUrl(sChildUrl), bChildExternal); oNewNav.Children.AddAsLast(oNewChildNav); arrNavNodes.Add(oNewChildNav.Id + (iCommunity != 0 ? ":" + appDef.Id : string.Empty)); iArrNodes.Add(oNewChildNav.Id.ToString()); } addMessage(ErrorLevels.NoError, sChildName, string.Empty, ParentNavMessageId); } else { addMessage(ErrorLevels.Warning, sChildName, "Url Doesn't Exist (" + sChildUrl + ")", ParentNavMessageId); } } catch (Exception ex2) { Trace.WriteLine(ex2.ToString()); addMessage(ErrorLevels.Warning, sChildName, "Error: " + ex2.Message, ParentNavMessageId); } } if (oNewNav != null) { oNewNav.Update(); } } catch (Exception ex1) { Trace.WriteLine(ex1.ToString()); addMessage(ErrorLevels.Warning, sParentName, "Error: " + ex1.Message, ParentMessageId); } } else { addMessage(ErrorLevels.Warning, sParentName, "Url Doesn't Exist (" + sParentUrl + ")", ParentMessageId); } counter++; var percent = counter / max; updateLIPercent(percent); } if (!bVerifyOnly && oParentListItem != null) { try { if (oParentListItem[navField].ToString() != string.Empty) { var Navs = oParentListItem[navField].ToString().Split(','); iArrNodes.AddRange(Navs); } } catch (Exception ex) { Trace.WriteLine(ex.ToString()); } oParentListItem[navField] = string.Join(",", (string[])iArrNodes.ToArray(typeof(string))); oParentListItem.Update(); } return(counter); }