I am recreating the left navigation bar with code in vb.Net. The code runs fine in my test environment and produces the desired results, but in production it does only almost perfect job. The last node added (nciHome - that should appear on the top) is missing. During debug I see all 7 child nodes, from which 6 is created on the site and there's no exception thrown. Code below, and idea welcome what might cause this behavior. Edit: It look like that it is the URL. I changed it to "myserver/" & strCustomerID in all nodes, and none of them was created. I also tried to link only to default.aspxthis not created either. Checked with support, no error thrown on server side either.

    Dim context As New ClientContext(strURL) 'create context
    Dim site As Web = context.Web
    Dim qlColl As NavigationNodeCollection = site.Navigation.QuickLaunch
    Dim nd As NavigationNode

    'delete nodes
    For i As Integer = qlColl.Count - 1 To 0 Step -1
    Next i

    'add new nodes
    Dim nciHead As New NavigationNodeCreationInformation
    Dim nciHome As New NavigationNodeCreationInformation
    Dim nciRep As New NavigationNodeCreationInformation
    Dim nciMinutes As New NavigationNodeCreationInformation
    Dim nciFin As New NavigationNodeCreationInformation
    Dim nciTech As New NavigationNodeCreationInformation
    Dim nciOth As New NavigationNodeCreationInformation
    Dim nciContract As New NavigationNodeCreationInformation

    'add Title - Customer Share
    With nciHead
        .Title = "Customer Share"
        .IsExternal = True
        .Url = "javascript: return true;"
    End With

    With nciHome
        nciHome.Title = "Homepage"
        .Url = "myserver/" & strCustomerID & "/default.aspx"
    End With

    With nciRep
        .Title = "Reports"
        .Url = "myserver/" & strCustomerID & "/Reports"
    End With

    With nciMinutes
        .Title = "Meetings-Minutes"
        .Url = "myserver/" & strCustomerID & "/Minutes"
    End With

    With nciContract
        .Title = "Contract"
        .Url = "myserver/" & strCustomerID & "/Contract"
    End With

    With nciFin
        .Title = "Financial Information"
        .Url = "myserver/" & strCustomerID & "/Invoices"
    End With

    With nciTech
        .Title = "Technical Documents"
        .Url = "myserver/" & strCustomerID & "/TechDocuments"
    End With

    With nciOth
        .Title = "Other"
        .Url = "myserver/" & strCustomerID & "/Other"
    End With

    nd = qlColl.Add(nciHead)



Just for the record, in case somebody else encounters this issue, a workaround was to create the node with a dummy (but valid) link and change it later in the script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.