Ejemplo n.º 1
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSite siteCollection = properties.Feature.Parent as SPSite;

            if (siteCollection != null)
            {
                SPWeb site = siteCollection.RootWeb;
                // create menu items on top link bar for custom site pages
                SPNavigationNodeCollection topNav = site.Navigation.TopNavigationBar;
                topNav.AddAsLast(new SPNavigationNode("Page 1", "WingtipPages/Page1.aspx"));
                topNav.AddAsLast(new SPNavigationNode("Page 2", "WingtipPages/Page2.aspx"));
                topNav.AddAsLast(new SPNavigationNode("Page 3", "WingtipPages/Page3.aspx"));
            }
        }
Ejemplo n.º 2
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSite siteCollection = (SPSite)properties.Feature.Parent;
            SPWeb  site           = siteCollection.RootWeb;

            // create dropdown menu for custom site pages
            SPNavigationNodeCollection topNav = site.Navigation.TopNavigationBar;

            SPNavigationNode DropDownMenu1 =
                topNav.AddAsLast(new SPNavigationNode("Web Parts 101", ""));

            DropDownMenu1.Children.AddAsLast(new SPNavigationNode("Web Part 1", "WebPartPages/WebPart1.aspx"));
            DropDownMenu1.Children.AddAsLast(new SPNavigationNode("Web Part 2", "WebPartPages/WebPart2.aspx"));
            DropDownMenu1.Children.AddAsLast(new SPNavigationNode("Web Part 3", "WebPartPages/WebPart3.aspx"));
            DropDownMenu1.Children.AddAsLast(new SPNavigationNode("Web Part 4", "WebPartPages/WebPart4.aspx"));
            DropDownMenu1.Children.AddAsLast(new SPNavigationNode("Web Part 5", "WebPartPages/WebPart5.aspx"));

            SPNavigationNode DropDownMenu2 =
                topNav.AddAsLast(new SPNavigationNode("Web Part Samples", ""));

            DropDownMenu2.Children.AddAsLast(new SPNavigationNode("Custom Properties", "WebPartPages/CustomProperties.aspx"));
            DropDownMenu2.Children.AddAsLast(new SPNavigationNode("Web Part Verbs", "WebPartPages/WebPartVerbs.aspx"));
            DropDownMenu2.Children.AddAsLast(new SPNavigationNode("Web Part Connections", "WebPartPages/WebPartConnections.aspx"));
            DropDownMenu2.Children.AddAsLast(new SPNavigationNode("Web Parts Preconnected", "WebPartPages/WebPartsPreconnected.aspx"));
            DropDownMenu2.Children.AddAsLast(new SPNavigationNode("Async Web Part Demo", "WebPartPages/AsyncDemoWebPart.aspx"));


            SPFile page = site.GetFile("WebPartPages/WebPartsPreconnected.aspx");
            SPLimitedWebPartManager mgr = page.GetLimitedWebPartManager(PersonalizationScope.Shared);

            FontConnectionProvider.FontConnectionProvider ProviderWebPart = new FontConnectionProvider.FontConnectionProvider();
            ProviderWebPart.Title         = "Left Brain";
            ProviderWebPart.UserGreeting  = "I look pretty";
            ProviderWebPart.TextFontSize  = 18;
            ProviderWebPart.TextFontColor = "Green";
            mgr.AddWebPart(ProviderWebPart, "Left", 0);

            FontConnectionConsumer.FontConnectionConsumer ConsumerWebPart = new FontConnectionConsumer.FontConnectionConsumer();
            ConsumerWebPart.Title        = "Right Brain";
            ConsumerWebPart.UserGreeting = "And so do I";
            mgr.AddWebPart(ConsumerWebPart, "Right", 0);

            mgr.SPConnectWebParts(
                ProviderWebPart,
                mgr.GetProviderConnectionPoints(ProviderWebPart).Default,
                ConsumerWebPart,
                mgr.GetConsumerConnectionPoints(ConsumerWebPart).Default
                );
        }
        //private static void CreateRootFolder(SPWeb curweb, string folderName, string folderDescription)
        //{
        //    curweb.Lists.Add(folderName, folderDescription, SPListTemplateType.DocumentLibrary);
        //    curweb.RootFolder
        //}

        // Uncomment the method below to handle the event raised before a feature is deactivated.
        private static void CreateSiteNavigation(SPFeatureReceiverProperties prop)
        {
            SPSite site    = prop.Feature.Parent as SPSite;
            SPWeb  rootWeb = site.RootWeb;
            SPNavigationNodeCollection topNavNodes = rootWeb.Navigation.TopNavigationBar;



            SPNavigationNode node = new SPNavigationNode("DashboardNav", "", true);

            topNavNodes.AddAsLast(node);

            SPNavigationNode oNewNode = new SPNavigationNode("Org Browser", "");

            rootWeb.Navigation.TopNavigationBar.AddAsLast(oNewNode);
            oNewNode.Properties.Add("NodeType", "Heading");
            oNewNode.Update();

            SPNavigationNode oChild1 = new SPNavigationNode("Official", "");

            oNewNode.Children.AddAsFirst(oChild1);
            oChild1.Properties.Add("NodeType", "Heading");
            oChild1.Update();



            // rootWeb.Navigation.UseShared = false;
            rootWeb.Update();

            //SPNavigationNode oNewNode = new SPNavigationNode("Org Browser", "");
            //rootWeb.Navigation.TopNavigationBar.AddAsLast(oNewNode);
            //oNewNode.Properties.Add("NodeType", "Heading");
            //oNewNode.Update();
        }
        // Uncomment the method below to handle the event raised after a feature has been activated.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPWeb site = properties.Feature.Parent as SPWeb;
            SPNavigationNodeCollection topNav  = site.Navigation.TopNavigationBar;
            SPNavigationNode           navNode = new SPNavigationNode("Wingtip Silverlight Product Browser", "_layouts/MSDN.WingtipProductBrowser/ProductBrowser.aspx");

            topNav.AddAsLast(navNode);
        }
        /// <summary>
        /// Occurs after a Feature is activated.
        /// </summary>
        /// <param name="properties">An <see cref="T:Microsoft.SharePoint.SPFeatureReceiverProperties" /> object that represents the properties of the event.</param>
        /// <exception cref="System.ApplicationException">
        /// In FeatureActivated the Site is null
        /// or
        /// </exception>
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            string _cp = "Starting";

            try
            {
                SPSite site = (SPSite)properties.Feature.Parent;
                if (site == null)
                {
                    throw new ApplicationException("In FeatureActivated the Site is null");
                }
                using (Entities _edc = new Entities(site.RootWeb.Url))
                {
                    ActivityLogCT.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "FeatureActivated strating");
                    _cp = "ReplaceMasterMage";
                    ReplaceMasterPage(site);
                    ActivityLogCT.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "Navigation setup starting");
                    _cp = "SPNavigationNodeCollection";
                    SPNavigationNodeCollection _topNav = site.RootWeb.Navigation.TopNavigationBar;
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuIPRBookTitle, ProjectElementManagement.URLIPRBookDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuIPRClosedBookTitle, ProjectElementManagement.URLIPRBookClosedDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuIPRBookCustomsOfficeTitle, ProjectElementManagement.URLIPRBookCustomsOfficeDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuIPRClosedBookCustomsOfficeTitle, ProjectElementManagement.URLIPRBookClosedCustomsOfficeDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuClearanceTitle, ProjectElementManagement.URLClearenceDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuClearanceViewTitle, ProjectElementManagement.URLClearenceViewDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuExportTitle, ProjectElementManagement.URLExportDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuBatchTitle, ProjectElementManagement.URLBatchDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuStocksTitle, ProjectElementManagement.URLStocksDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuReportsTitle, ProjectElementManagement.URLReportsDashboard));
                    foreach (SPNavigationNode item in _topNav)
                    {
                        item.Update();
                    }
                    //WebPartPages.ProjectElementManagement.SetupConnections(_edc, _root);
                    _cp = "Entities.Anons";
                    ActivityLogCT.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "FeatureActivated finished");
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("FeatureActivated exception at {0}: {1}", _cp, ex.Message));
            }
        }
        // Uncomment the method below to handle the event raised after a feature has been activated.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSite siteCollection = properties.Feature.Parent as SPSite;

            if (siteCollection != null)
            {
                SPWeb site = siteCollection.RootWeb;

                SPNavigationNodeCollection topNav = site.Navigation.TopNavigationBar;
                topNav.AddAsLast(new SPNavigationNode("DataGrid", "SitePages/DataGridPage.aspx"));
            }
        }
        public SPNavigationNodeInstance AddAsLast(SPNavigationNodeInstance node)
        {
            if (node == null)
            {
                throw new JavaScriptException(Engine, "Error", "node must be specified.");
            }

            var result = m_navigationNodeCollection.AddAsLast(node.SPNavigationNode);

            return(result == null
                ? null
                : new SPNavigationNodeInstance(Engine.Object.InstancePrototype, result));
        }
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            string _cp = "Starting";

            try
            {
                SPSite site = (SPSite)properties.Feature.Parent;
                if (site == null)
                {
                    throw new ApplicationException("In FeatureActivated the Site is null");
                }
                using (Entities _edc = new Entities(site.RootWeb.Url))
                {
                    ActivityLogCT.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "FeatureActivated strating");
                    ActivityLogCT.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "Navigation setup starting");
                    _cp = "SPNavigationNodeCollection";
                    SPNavigationNodeCollection _topNav = site.RootWeb.Navigation.TopNavigationBar;
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuCWBookTitle, ProjectElementManagement.URLCWBookDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuCWBookClosedTitle, ProjectElementManagement.URLCWBookClosedDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuCWBookCustomsOfficeTitle, ProjectElementManagement.URLCWBookCustomsOfficeDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuCWBookClosedCustomsOfficeTitle, ProjectElementManagement.URLCWBookClosedCustomsOfficeDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuCheckListExitSheetTitle, ProjectElementManagement.URLCheckListExitSheetDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuSupplementCWBookTitle, ProjectElementManagement.URLSupplementCWBookDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuSupplementWZNoTitle, ProjectElementManagement.URLSupplementWZNoDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuDisposalRequestTitle, ProjectElementManagement.URLDisposalRequestDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuDisposalsViewTitle, ProjectElementManagement.URLDisposalsViewDashboard));
                    foreach (SPNavigationNode item in _topNav)
                    {
                        item.Update();
                    }
                    //WebPartPages.ProjectElementManagement.SetupConnections(_edc, _root);
                    _cp = "Entities.Anons";
                    ActivityLogCT.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "FeatureActivated finished");
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("FeatureActivated exception at {0}: {1}", _cp, ex.Message));
            }
        }
Ejemplo n.º 9
0
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            if (properties.Feature.Parent is SPSite)
            {
                // cannot activate this feature on site level
                return;
            }
            SPWeb web = (SPWeb)properties.Feature.Parent;
            SPNavigationNodeCollection topNavi = web.Navigation.TopNavigationBar;

            // Check existing top element. If present remove first
            CheckAndRemove(topNavi);
            // Read navigation instruction
            XNamespace siteNM = "http://schemas.microsoft.com/AspNet/SiteMap-File-1.0";

            using (Stream st = GetType().Assembly.GetManifestResourceStream("ApplicationPage.web.sitemap"))
            {
                using (XmlReader tr = new XmlTextReader(st))
                {
                    try
                    {
                        XElement siteMap = XElement.Load(tr);
                        // add nodes
                        var root = from r in siteMap.Descendants()
                                   where r.Attribute("title").Value.Equals("HR Department")
                                   select r;
                        // Found
                        if (root.Count() == 1)
                        {
                            XElement rootElement = root.First();
                            string   rootPath    = web.Url + PATH;
                            // create and add rootnode
                            SPNavigationNode rootNode = new SPNavigationNode(
                                rootElement.Attribute("title").Value,
                                rootPath + rootElement.Attribute("url").Value,
                                true);
                            SPNavigationNode topNode = topNavi.AddAsLast(rootNode);
                            AddNodes(rootElement, topNode, rootPath);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
        }
        // Uncomment the method below to handle the event raised after a feature has been activated.

        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            try
            {
                SPSite siteCollection = properties.Feature.Parent as SPSite;
                if (siteCollection != null)
                {
                    SPWeb site = siteCollection.RootWeb;

                    SPNavigationNodeCollection topNav = site.Navigation.TopNavigationBar;
                    topNav.AddAsLast(new SPNavigationNode("DataGrid-Updated", "SitePages/DataGridPage.aspx"));
                }
            }
            catch (Exception ex)
            {
                SPUtility.LogCustomAppError(ex.Message + "\n" + ex.StackTrace);
            }
        }
Ejemplo n.º 11
0
        public override void AddNavigationNode(string title, string url, NavigationNodeLocation location)
        {
            SPNavigationNodeCollection topnav = null;
            SPNavigationNode           node   = new SPNavigationNode(title, url);

            if (_spWeb.Navigation.GetNodeByUrl(node.Url) != null)
            {
                return;
            }
            switch (location)
            {
            case NavigationNodeLocation.TopNavigationBar:
                topnav = _spWeb.Navigation.TopNavigationBar;
                topnav.AddAsLast(node);
                break;

            case NavigationNodeLocation.QuickLaunchLists:
                _spWeb.Navigation.AddToQuickLaunch(node, SPQuickLaunchHeading.Lists);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(location), location, null);
            }
        }
        /// <summary>
        /// Occurs after a Feature is activated.
        /// </summary>
        /// <param name="properties">An <see cref="T:Microsoft.SharePoint.SPFeatureReceiverProperties" /> object that represents the properties of the event.</param>
        /// <exception cref="System.ApplicationException">
        /// In FeatureActivated the Site is null
        /// or
        /// </exception>
        public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            string _cp = "Starting";

            try
            {
                SPSite site = (SPSite)properties.Feature.Parent;
                if (site == null)
                {
                    throw new ApplicationException("In FeatureActivated the Site is null");
                }
                using (EntitiesDataContext _edc = new EntitiesDataContext(site.RootWeb.Url))
                {
                    Anons.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "FeatureActivated strating");
                    _cp = "ReplaceMasterMage";
                    ReplaceMasterMage(site);
                    Anons.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "Navigation setup starting");
                    _cp = "SPNavigationNodeCollection";
                    SPNavigationNodeCollection _topNav = site.RootWeb.Navigation.TopNavigationBar;
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuVendorTitle, ProjectElementManagement.URLVendorDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuInboundOwnerTitle, ProjectElementManagement.URLInboundOwner));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuViewInboundsTitle, ProjectElementManagement.URLViewInbounds));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuViewOutboundsTitle, ProjectElementManagement.URLViewOutbounds));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuOutboundOwnerTitle, ProjectElementManagement.URLOutboundOwner));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuOutboundCoordinatorTitle, ProjectElementManagement.URLOutboundCoordinator));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuForwarderTitle, ProjectElementManagement.URLForwarderDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuSecurityEscortProviderTitle, ProjectElementManagement.URLSecurityEscortProviderDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuSecurityGateTitle, ProjectElementManagement.URLGateDashboard));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuOperatorTitle, ProjectElementManagement.URLOperator));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuSupervisorTitle, ProjectElementManagement.URLSupervisor));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuDriversTitle, ProjectElementManagement.URLDrivers));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuTrucksTitle, ProjectElementManagement.URLTrucks));
                    _topNav.AddAsLast(new SPNavigationNode(ProjectElementManagement.MenuTrailersTitle, ProjectElementManagement.URLTrailers));
                    foreach (SPNavigationNode item in _topNav)
                    {
                        item.Update();
                    }
                    //WebPartPages.ProjectElementManagement.SetupConnections(_edc, _root);
                    _cp = "Entities.Anons";
                    Anons.WriteEntry(_edc, m_SourceClass + m_SourceFeatureActivated, "FeatureActivated finished");
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("FeatureActivated exception at {0}: {1}", _cp, ex.Message));
            }
        }
Ejemplo n.º 13
0
        public static void ProvisionWebStructure(this SPWeb web, WebDefinitionCollection subsites)
        {
            foreach (var site in subsites)
            {
                var existed = web.Webs.Cast <SPWeb>().Where(p => p.Url.Contains(site.Url)).FirstOrDefault();

                if (existed != null && !site.Overwrite)
                {
                    continue;
                }
                if (existed != null && site.Overwrite)
                {
                    DeleteSite(existed);
                }

                var newSite = web.AddSite(site.Url.Trim(), site.Name.Trim(), site.Template.Trim());
                if (newSite == null)
                {
                    continue;
                }
                //Provision Lists
                //Provision Features
                foreach (var feature in site.Features)
                {
                    newSite.Features.Add(feature.Guid);
                    //newSite.Update();
                }

                //BreakRoleInheritance
                if (site.BreakRoleInheritance)
                {
                    try
                    {
                        newSite.AllowUnsafeUpdates = true;

                        if (!newSite.HasUniqueRoleAssignments)
                        {
                            newSite.BreakRoleInheritance(false);
                        }

                        //create group
                        string groupOwners = site.Name.Trim() + " Owners";
                        newSite.CreateNewGroup(groupOwners, "Use this group to grant people full control permissions to the SharePoint site: " + site.Name.Trim(), SPRoleType.Administrator);

                        string groupMembers = site.Name.Trim() + " Members";
                        newSite.CreateNewGroup(groupMembers, "Use this group to grant people contribute permissions to the SharePoint site: " + site.Name.Trim(), SPRoleType.Contributor);

                        string groupVisitors = site.Name.Trim() + " Visitors";
                        newSite.CreateNewGroup(groupVisitors, "Use this group to grant people read permissions to the SharePoint site: " + site.Name.Trim(), SPRoleType.Reader);

                        newSite.Update();

                        Utility.ChangeSPGroupOwnerBySPGroup(newSite, groupOwners, groupOwners);
                        Utility.ChangeSPGroupOwnerBySPGroup(newSite, groupMembers, groupOwners);
                        Utility.ChangeSPGroupOwnerBySPGroup(newSite, groupVisitors, groupOwners);

                        SPUser authenUsers = newSite.EnsureUser("NT AUTHORITY\\authenticated users");
                        if (authenUsers != null)
                        {
                            SPGroup spGrp = newSite.Groups[groupVisitors];
                            if (spGrp != null)
                            {
                                spGrp.AddUser(authenUsers);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                    finally
                    {
                        newSite.AllowUnsafeUpdates = false;
                    }
                }


                //provision Top Navigation Bar
                try
                {
                    newSite.AllowUnsafeUpdates = true;

                    SPNavigationNodeCollection topnav = newSite.Navigation.TopNavigationBar;

                    //clear all
                    for (int i = topnav.Count - 1; i >= 0; i--)
                    {
                        topnav.Delete(topnav[i]);
                    }

                    string           linkTitle = newSite.Title;
                    SPNavigationNode node      = new SPNavigationNode(linkTitle, newSite.ServerRelativeUrl);
                    node = topnav.AddAsLast(node);

                    SPWeb            rootWeb       = web.Site.RootWeb;
                    string           linkRootTitle = rootWeb.Title;
                    SPNavigationNode nodeRoot      = new SPNavigationNode(linkRootTitle, rootWeb.ServerRelativeUrl);
                    nodeRoot = topnav.AddAsFirst(nodeRoot);

                    //AddParentNode(newSite, topnav);
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    newSite.AllowUnsafeUpdates = false;
                }

                if (site.SubSites.Count > 0)
                {
                    newSite.ProvisionWebStructure(site.SubSites);
                }
            }
        }
        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);
        }