none
why i can not got list details RRS feed

  • 问题

  • Hi all:

    i had use this code to got list detail, but i can not got any list items, why?

    my sharepoint server is 2010, and this code will be working at silverlight 4

    //dedine clientcontext object
     ClientContext _cc;
        ClientContext CC
        {
          get
          {
            if (_cc == null)
            {
              _cc = new ClientContext("http://127.0.0.1/ea");
            }
            return (_cc);
          }
        }
    
    
    //get list and listitems
    new Thread(new ThreadStart(() =>
          {
            ListCollection listColl = CC.Web.Lists;
            CC.Load(listColl);
            CC.ExecuteQuery();
            this.c_list.Dispatcher.BeginInvoke(() =>
            {
              c_list.ItemsSource = listColl;
            });
            CamlQuery cq = new CamlQuery();
            cq.ViewXml = "<View/>";
            foreach (List l in listColl)
            {
              ListItemCollection lc = l.GetItems(cq);
              CC.Load(lc);
              CC.ExecuteQuery();
              this.c_list_item.Dispatcher.BeginInvoke(() =>
              {
                this.c_list_item.Items.Add(string.Format("{0}-{1}", l.ItemCount, lc.Count));
              });
            }
          })).Start();
    
    after the code runing, i saw some items like this 14-0 in c_list_item,that means ItemCount=14, but the listitemcollection.coumt=0 why? can anybody help me?
    2010年8月8日 7:30