读书人

关于在Silverlight中得到SharePoint20

发布时间: 2012-02-09 18:22:27 作者: rapoo

关于在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.

读书人网 >行业软件

热点推荐