Although I have tried everything ,almost every code to get the contents of a list in sharepoint 2010 ,Why am I not able to get the files... below is my code:
ClientContext ctx = new ClientContext("http://sharepoint-one
Site site = ctx.Site;
Web web = site.RootWeb;
ListCollection lists = web.Lists;
List taskList = lists.GetByTitle("Shared Documents");
CamlQuery query =CamlQuery.CreateAllItemsQ
ListItemCollection listItems = taskList.GetItems(query);
I have a silverlight application this needs to get into a list in sharepoint and get the files inside... but somehow the code above gives the exception CollectionNotInitializedEx
ception in the first line even though the exception i can continue with F10 in debug mode but then it gives error in executequery saying that :
The method or property that is called may block the UI thread and it is not allowed. Please use background thread to invoke the method or property, for example, using System.Threading.ThreadPoo
rWorkItem method to invoke the method or property.
if I use ExecuteQueryAsync(Onsucces
e); then it somehow does not go to onsuccess or onfailure methods and continues like nothing happens and i cannot get list specific information...
like the count of the items inside the list with
int count = 0;
foreach (ListItem a in listItems)
when I try to get info about the list with above code I get the error msg below...
The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.