Bonjour,
J'ai actuellement une application silverlight vb .net, que je veux connecté à une liste Sharepoint nommé agent.
Alors après plusieurs recherches, voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Public Shared Sub BeginExecuteCustomersQuery()
 
        Dim myUri As New Uri("http://vmsp2010001:17000/Formation/_vti_bin/listdata.svc")
        Dim context As New Sharepoint_Formation.FormationDataContext(myUri)
 
        Dim callback As AsyncCallback = AddressOf OnQueryComplete
        Dim query As DataServiceQuery(Of Sharepoint_Formation.AgentItem) = context.Agent.Expand("Orders")
 
        Try
 
            query.BeginExecute(callback, query)
        Catch ex As DataServiceQueryException
            MessageBox.Show(ex.ToString())
 
        End Try
 
    End Sub
 
    Private Shared Sub OnQueryComplete(ByVal result As IAsyncResult)
        ' Get the original query from the result.
        Dim monresultat As String
        Dim query As DataServiceQuery(Of Sharepoint_Formation.AgentItem) = CType(result.AsyncState, DataServiceQuery(Of Sharepoint_Formation.AgentItem))
        monresultat = ""
        ' Complete the query execution.
        For Each agent As Sharepoint_Formation.AgentItem In query.EndExecute(result)
 
            monresultat = monresultat & " " & agent.Nomagent
 
        Next
 
    End Sub
 
    Private Sub BtnConnexion_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles BtnConnexion.Click
        BeginExecuteCustomersQuery()
    End Sub
Et j'ai une erreur sur le For each qui est :
"{System.InvalidOperationException: Une erreur s'est produite lors du traitement de cette requête. ---> System.Security.SecurityException: Erreur de sécurité." & vbCrLf & " à System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)" & vbCrLf & " à System.Data.Services.Http.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)" & vbCrLf & " à System.Data.Services.Client.QueryResult.AsyncEndGetResponse(IAsyncResult asyncResult)" & vbCrLf & " --- Fin de la trace de la pile d'exception interne ---" & vbCrLf & " à System.Data.Services.Client.BaseAsyncResult.EndExecute[T](Object source, String method, IAsyncResult asyncResult)" & vbCrLf & " à System.Data.Services.Client.QueryResult.EndExecute[TElement](Object source, IAsyncResult asyncResult)" & vbCrLf & " à System.Data.Services.Client.DataServiceRequest.EndExecute[TElement](Object source, DataServiceContext context, IAsyncResult asyncResult)" & vbCrLf & " à System.Data.Services.Client.DataServiceQuery`1.EndExecute(IAsyncResult asyncResult)" & vbCrLf & " à Formation_Silverlight.MainPage.OnQueryComplete(IAsyncResult result)" & vbCrLf & " à System.Data.Services.Client.BaseAsyncResult.HandleCompleted()" & vbCrLf & " à System.Data.Services.Client.QueryResult.AsyncEndGetResponse(IAsyncResult asyncResult)" & vbCrLf & " à System.Data.Services.Client.BaseAsyncResult.<>c__DisplayClass1.<GetDataServiceAsyncCallback>b__0(IAsyncResult asyncResult)" & vbCrLf & " à System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass1a.<InvokeGetResponseCallback>b__18(Object state2)" & vbCrLf & " à System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)" & vbCrLf & " à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)" & vbCrLf & " à System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()" & vbCrLf & " à System.Threading.ThreadPoolWorkQueue.Dispatch()" & vbCrLf & " à System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()}"

Je suis débutant en web je me suis donc aidé de : http://msdn.microsoft.com/fr-fr/library/dd756367.aspx.
Merci d'avance.