首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 企业软件 > 行业软件 >

关于在Silverlight中得到SharePoint2010列表有关问题

2012-02-09 
关于在Silverlight中得到SharePoint2010列表问题void MainPage_Loaded(object sender, RoutedEventArgs e)

关于在Silverlight中得到SharePoint2010列表问题
 
  void MainPage_Loaded(object sender, RoutedEventArgs e)
  {
  string siteUrl = "http://zhoukai/sites/SL";

  ClientContext clientContext = new ClientContext(siteUrl);
  List oList = clientContext.Web.Lists.GetByTitle("NavText");

  CamlQuery camlQuery = new CamlQuery();
  camlQuery.ViewXml = "<View><Query><Where><Geq><FieldRef Name='ID'/>" +
  "<Value Type='Number'>10</Value></Geq></Where></Query><RowLimit>100</RowLimit></View>";
  ListItemCollection collListItem = oList.GetItems(camlQuery);

  clientContext.Load(collListItem);

  clientContext.ExecuteQuery();
  StringBuilder sb = new StringBuilder();
  foreach (ListItem oListItem in collListItem)
  {
  sb.Append(string.Format("ID: {0} \nTitle: {1} \nBody: {2}\n", oListItem.Id, oListItem["Title"], oListItem["Body"]));
  }
  this.textBox1.Text = sb.ToString();
  }


在执行clientContext.ExecuteQuery();
这个方法的时候会报错。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.ThreadPool.QueueUserWorkItem method to invoke the method or property.

[解决办法]
http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/bc5e4773-486f-478c-884d-433762cdb716/
这个看过么 ?
[解决办法]
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.ThreadPool.QueueUserWorkItem method to invoke the method or property.

热点排行