SOLVED

ListCreationInformation.QuickLaunchOption ignored on Sharepoint Online?

Occasional Contributor

ListCreationInformation.QuickLaunchOption seems to be ignored when creating a list on sharepoint online with CSOM.

How can I achieve the same goal?

1 Reply
best response confirmed by Ignzo (Occasional Contributor)
Solution

I accomplished this by adding the following code after creating the list:

      'Menu QuickLaunch
      If listInfo.QuickLaunchOption = QuickLaunchOptions.On Then
        Dim quickLaunchCollection As NavigationNodeCollection = wWeb.Navigation.QuickLaunch
        context.Load(quickLaunchCollection)
        context.ExecuteQuery()

        If quickLaunchCollection.Where(Function(nn) String.Equals(nn.Url, lList.RootFolder.ServerRelativeUrl, StringComparison.OrdinalIgnoreCase)).Any = False Then
          Dim navigationNodeCreationInformation As NavigationNodeCreationInformation = New NavigationNodeCreationInformation()
          navigationNodeCreationInformation.Title = If(String.IsNullOrEmpty(listInfo.Title), "josh " & DateTime.Now.ToString("yyyyMMdd HHmmss"), listInfo.Title)
          navigationNodeCreationInformation.Url = lList.RootFolder.ServerRelativeUrl
          navigationNodeCreationInformation.AsLastNode = True

          quickLaunchCollection.Add(navigationNodeCreationInformation)
          context.ExecuteQuery()
        End If
      End If