sharepoint 查询统计list数据,使用CAML联合datatable方法

本文介绍如何利用CAML查询结合DataTable来统计SharePoint列表中根据审批结果的个人、部门数据,包括已批准和未批准的条目。内容涉及复杂的技术实现,但具体细节省略。
摘要由CSDN通过智能技术生成

       需求;根据审批结果,统计上月个人,部门。财务已批准和未批准的综合。各种复杂技术不赘述。

      新浪微博   jasondct 

        /// <summary>

        /// 计算时间范围内各类审批统计
        /// </summary>
        /// <param name="monthfirst">月处</param>
        /// <param name="monthend">月末</param>
        protected void GetCostBudge(DateTime monthfirst, DateTime monthend)
        {
            //转换时间
            string monthfirst1 = SPUtility.CreateISO8601DateTimeFromSystemDateTime(monthfirst);
            string monthend1 = SPUtility.CreateISO8601DateTimeFromSystemDateTime(monthend);
            //获得当前列表
            using (SPSite site = new SPSite(SPContext.Current.Site.ID))
            {
                using (SPWeb web = site.OpenWeb("expense"))
                {
                    SPList list = web.Lists["EBRL"];
                    SPQuery Query = new SPQuery();
                    Query.Query = string.Format(@"<Where><And><Geq><FieldRef Name='SubmitTime' /><Value IncludeTimeValue='TRUE' Type='DateTime'>{0}</Value>
                    </Geq><Leq><FieldRef Name='SubmitTime' /><Value IncludeTimeValue='TRUE' Type='DateTime'>{1}</Value></Leq></And></Where>",monthfirst1, monthend1 );
                    Query.ViewFields = @"<FieldRef Name='FreeType' />
                                            <FieldRef Name='Total'/>
                                            <FieldRef Name='State'/> 
                                            <FieldRef Name='Dep'/>   
                                             <FieldRef Name='DepID'/>   
                                            <FieldRef Name='ApplyName'/> ";
               
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值