sharepoint 2010 开发人员演练 练习三
来源:互联网 发布:html编程有什么作用 编辑:程序博客网 时间:2024/04/29 05:36
为客户端对象模型创建silverlight应用程序 后台代码
PDF里打得不清楚,这边整理一下
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.SharePoint.Client;
namespace SPSilverlightExample
{
public class Project
{
public string Title { get; set; }
public DateTime DueDate { get; set; }
public string Description { get; set; }
}
public partial class MainPage : UserControl
{
private ListItemCollection _projects;
public MainPage()
{
InitializeComponent();
ClientContext context = new ClientContext(ApplicationContext.Current.Url);
context.Load(context.Web);
List Projects = context.Web.Lists.GetByTitle("Projects");
context.Load(Projects);
CamlQuery query = new Microsoft.SharePoint.Client.CamlQuery();
string camlQueryXml = "<View><Query><Where><Gt>" +
"<FieldRef Name='Due_x0020_Date' />" +
"<Value Type='DateTime'>2008-01-1T00:00:00Z</Value>" +
"</Gt></Where></Query><ViewFields>" +
"<FieldRef Name=/"Title/" /><FieldRef Name=/"Description/" />" +
"<FieldRef Name=/"Due_x0020_Date/" />" +
"</ViewFields></View>";
query.ViewXml = camlQueryXml;
_projects = Projects.GetItems(query);
context.Load(_projects);
context.ExecuteQueryAsync(new
ClientRequestSucceededEventHandler(OnRequestSucceeded), null);
}
private void OnRequestSucceeded(Object sender, ClientRequestSucceededEventArgs args)
{
// this is not called on the UI thread
Dispatcher.BeginInvoke(BindData);
}
private void BindData()
{
List<Project> projects = new List<Project>();
foreach (ListItem li in _projects)
{
projects.Add(new Project()
{
Title = li["Title"].ToString(),
DueDate = Convert.ToDateTime(li["Due_x0020_Date"].ToString()),
Description = li["Description"].ToString()
});
}
dataGrid1.ItemsSource = projects; // must be on UI thread
}
}
}
- sharepoint 2010 开发人员演练 练习三
- SharePoint 2010 开发人员面板 (dashboard)
- SharePoint 2010多语言UI,以及开发人员需要注意的
- SharePoint 2010多语言UI,以及开发人员需要注意的
- Microsoft Windows Workflow Foundation 入门:开发人员演练
- Microsoft Windows Workflow Foundation 入门:开发人员演练
- Microsoft Windows Workflow Foundation 入门:开发人员演练
- Microsoft Windows Workflow Foundation 入门:开发人员演练
- Microsoft Windows Workflow Foundation 入门:开发人员演练
- 公司现招募sharepoint开发人员
- Microsoft Windows Workflow Foundation 入门:开发人员演练(一)
- Microsoft Windows Workflow Foundation 入门:开发人员演练(二)
- 一个SharePoint开发人员必备的工具
- 一个SharePoint开发人员必备的工具
- 演练
- >+ 实例演练ASP+XML编程(三)
- 自定制SharePoint 2010的三种部署方式
- 练习三
- RTEMS 4.9.5:QEMU MINI2440 BSP 中的网络驱动开发(上)
- python的几个内建函数:apply(),filter(),map(),reduce(
- 【转载】C# winform登陆框验证码的实现
- GE,FE,E1,POS等通信设备接口
- Python函数参数
- sharepoint 2010 开发人员演练 练习三
- Python中set的用法
- 指针算术运算
- 为什么要用IOC
- Python多线程编程
- java基础之对象的clone(浅拷贝)
- 如何删除ubuntu中多余的内核镜像
- 原来flash player对图片的解码不是异步的,AIR2.6后就异步了
- fedora 13 安装与配置(一)----准备