Hi @Bharathi Paulraj
Per my test, you can refer to following code to delete the links in sharepoint navigation.
using (ClientContext clientContext = new ClientContext("http://MyServer/sites/MySiteCollection"))
{
NavigationNodeCollection navigationNodes = null;
// Option 1: This will get quick launch collection from parent web
// This option will work only if the method is running from sub-site otherwise parent ID will be Null
clientcontext.Load(clientcontext.Web.ParentWeb, p => p.Id);
clientcontext.ExecuteQuery();
navigationNodes = clientcontext.Site.OpenWebById(clientcontext.Web.ParentWeb.Id).Navigation.QuickLaunch;
// Option 2: This will get quick launch collection from current site
navigationNodes = clientcontext.Web.Navigation.QuickLaunch;
clientcontext.Load(navigationNodes);
clientcontext.ExecuteQuery();
NavigationNode node = (from navigationNode in navigationNodes where "Navigation node name" == navigationNode.Title select navigationNode).FirstOrDefault();
// Condition to check the existence of the navigation node.
if (node != null)
{
node.DeleteObject();
clientcontext.ExecuteQuery();
}
}
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.