SilverLight 中的异步代码与 SharePoint
我的代码有一些问题。我按下按钮后有 silverlight 按钮,我想加载文档库并获取有关该库中有多少项目的信息,我的代码是:
var web = context.Web;
List sharedDocumentsList = context.Web.Lists.GetByTitle("dokumenty");
int i = sharedDocumentsList.ItemCount;
context.Load(sharedDocumentsList);
context.ExecuteQueryAsync(OnFileWriteSucceeded, OnFileWriteFailed);
但我仍然遇到同样的问题。
集合尚未初始化。尚未请求或请求尚未执行。可能需要明确请求
我如何获取 ItemCount。这只是一个简单的例子,我需要循环使用这个列表等等。但我需要解决这个主要问题。如何直接在按钮单击方法中使用此文档列表。
谢谢。
I have some problem with my code. I have silverlight button after I press button I want to load document library and get information about how many items are in this library co my code is:
var web = context.Web;
List sharedDocumentsList = context.Web.Lists.GetByTitle("dokumenty");
int i = sharedDocumentsList.ItemCount;
context.Load(sharedDocumentsList);
context.ExecuteQueryAsync(OnFileWriteSucceeded, OnFileWriteFailed);
But I got still same problem.
The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explixitly requested
How Can I get ItemCount. This is only a simple example I need to work with this list in cycle and so on. But I need to solve this main problem. How to work with this documentlist directly in button click method.
Thank You.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这对我有用:
This works for me: