VB.net Get Files and folders in sharepoint without subfolder content

  • Thread starter Thread starter Amateurtje
  • Start date Start date
A

Amateurtje

Guest
Hello,

I am already some time busy trying to get this done. I am not very experienced with interfacing SharePoint etc.

I have managed to log into SharePoint but Now I want to display only the files and folders in a folder. Later on, I would like to open the pdf's in this folder, but that is a later issue.

I only get a list with files with all content of the subfolders. But I do not want the contant of the subfolders. Also the amount I would get is too much for the maximum of the site will give..


The below code works to get all files and folders (and all files in the subfolders, what I do not want) displayed in a textbox and listview...

Dim testList As List = context.Web.Lists.GetByTitle("Production")
Dim query As CamlQuery = CamlQuery.CreateAllItemsQuery(1000)
Dim items As ListItemCollection = testList.GetItems(query)
context.Load(items)

context.ExecuteQuery()
For Each listItem As ListItem In items
TextBox1.Text = TextBox1.Text & ControlChars.CrLf & listItem("FileRef")
Dim listje As New ListViewItem
listje.Name = listItem("FileRef")
listje.Text = listItem("FileRef")
ListView1.Items.Add(listje)
Next
Can anybody help me or point in the right diection?

Continue reading...
 
Back
Top