Skip to content

How to get child Navigation nodes #1472

Answered by jansenbe
metkhoo asked this question in Q&A
Discussion options

You must be logged in to vote

@metkhoo : below code works for me:

var nodes = await context.Web.Navigation.GetAsync(n => n.QuickLaunch);
foreach (var item in nodes.QuickLaunch.AsRequested())
{
    if (item.Title == "I have child nodes")
    {
        var childNodes = await item.GetChildNodesAsync();
        foreach(var childNode in childNodes)
        {
            Console.WriteLine(childNode.Title);
        }
    }
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@metkhoo
Comment options

Answer selected by metkhoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants