CodeArt.SharePoint.CamlQuery_0.9發布(源碼)

來源:互聯網
上載者:User
It's not a happy job to write caml query xml to return data from shrepoint list. So , I write the tool to make it easy.

the code example:

-------------------------
            using Microsoft.SharePoint;
            using CodeArt.SharePoint.CamlQuery;

            SPSite site = new SPSite("http://jyserver:81");

            SPList list = site.RootWeb.Lists["Notice"];

            QueryField field1 = new QueryField("標題",false); //the second parameter explain if the first parameter is a internal name.
            //or : QueryField field1 = new QueryField("Title"); //"Title" is a internal name.
           
            TypedQueryField<DateTime> field2 = new TypedQueryField<DateTime>("Expires");

            CamlExpression expr = field1.Contains("Test1");

            SPListItemCollection items =
                ListQuery.Select( field1)
                .From(list)
                .Where(expr)
                .OrderBy(field1)
                .GetItems();
               
           items =
                ListQuery.Select( field1)
                .From(list)
                .Where( field1..Contains("Test1") && field2 >= DateTime.Now.AddDays(-1)  )
                .OrderBy(field1)
                .GetItems();    
               
            items =
                ListQuery.Select( 10 , field1, field2 ) // limit result count.
                .From(list)
                .Where( field1..Contains("Test1") && field2 >= DateTime.Now.AddDays(-1)  )
                .OrderBy(field1)
                .GetItems();   
               
           items =
                ListQuery.Select( field1 , field2 )
                .From(list)
                .Where( field1..Contains("Test1") && field2 >= DateTime.Now.AddDays(-1)  )
                .OrderBy(field1,false)
                .OrderBy(field2,true) //
                .GetItems();    
               
You can download all source file from: http://www.codeplex.com/camlquery
or:http://www.codeplex.com/camlquery/Release/ProjectReleases.aspx
 
相關: WSS3.0開發--你還在為寫CAML痛苦嗎?

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.