How to get the field of list item of sharepoint in ListView


Hi All…. This the code which get the fields of listitems in columns of ListView….. Check it out… It will also add ID of all items in Listivew’s first column……
 

For Each splist In spsite.OpenWeb.Lists

If (splist.Title = TvSites.SelectedNode.Text) Then

For Each SPField In splist.Fields

LvListItems.Columns.Add(SPField.Title.ToString)

‘i = i + 1

Next

If (splist.Items.Count > 0) Then

For Each splistitem In splist.Items

LvListItems.Items.Add(splistitem.Item(0).ToString)

Next

Else

MessageBox.Show(

"No Items in Selected List", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)

End If

End If

Next

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: