Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
share|improve this question
    
try accessing field values like _ListItem.("FullName") –  Arsalan Adam Khatri Oct 15 '12 at 10:02

1 Answer 1

To get more details about the exception, You should use try catch block. Update your question with the exact exception details to get better answers

share|improve this answer
    
Thanks. I'll try that and report back. –  finisterre Oct 12 '12 at 18:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.