I'm trying to read the contents of Sharepoint List 'pfa' using Silverlight 5 and the following VB code. I am geting diagnostic pop-up windows 1-5 but then that's it and nothing further happens. Sharepoint Foundation is running on the local machine.
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Net
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes
Imports sp = Microsoft.SharePoint.Client
Partial Public Class MainPage
Inherits UserControl
Public Class Person
Public Property PersonName As String
Public Property PersonRole As String
Public Property PersonLength As String
End Class
Private Sub UserControl_Loaded(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
Using ctx As New sp.ClientContext("http://localhost")
MessageBox.Show("1")
'Dim ctx As sp.ClientContext = sp.ClientContext.Current
Dim _List As sp.List = ctx.Web.Lists.GetByTitle("pfa")
MessageBox.Show("2")
'Dim _Query = sp.CamlQuery.CreateAllItemsQuery
Dim _Query As New sp.CamlQuery()
_Query.ViewXml = "<View><Query><Where><IsNotNull><FieldRef Name='FullName' /></IsNotNull></Where></Query></View>"
MessageBox.Show("3")
Dim _ListItemCollection As sp.ListItemCollection = _List.GetItems(_Query)
MessageBox.Show("4")
ctx.Load(_ListItemCollection)
MessageBox.Show("5")
ctx.ExecuteQuery()
MessageBox.Show("6")
Dim _People As New List(Of Person)
MessageBox.Show("Just Before Loop")
For Each _ListItem As sp.ListItem In _ListItemCollection
Dim _Person As New Person
_Person.PersonName = _ListItem.FieldValues("FullName")
_Person.PersonRole = _ListItem.FieldValues("Role")
_People.Add(_Person)
MyOutput.Text += _Person.PersonName & vbLf & _Person.PersonRole
Next
End Using
End Sub
End Class