如何使用Spquery和Caml在Sharepoint列表中插入新项目 [英] How Can I Insert New Item In Sharepoint List Using Spquery And Caml

查看:113
本文介绍了如何使用Spquery和Caml在Sharepoint列表中插入新项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码从列表中检索特定项目,

i have the following code to retrieve particular item from the list ,

SPWeb mySite = SPContext.Current.Web;

            SPList li = mySite.Lists["List"];

                SPQuery oQuery = new SPQuery();

                oQuery.Query = string.Concat("<Where><Eq>",
                                                    "<FieldRef Name='ID'/>",
                                                    "<Value Type='Number'>6</Value>",
                                              "</Eq></Where>");


                oQuery.ViewFields = string.Concat(
                                       "<FieldRef Name='ID'/>",
                                       "<FieldRef Name='Title'/>",
                                       "<FieldRef Name='Email'/>",
                                       "<FieldRef Name='Department'/>");

                oQuery.ViewFieldsOnly = true;
                SPListItemCollection collListItems = li.GetItems(oQuery);

          

                foreach (SPListItem oListItem in collListItems)
                {
                    Label9.Text = oListItem["Title"].ToString();
                }

i want to ask how can i insert item in the list .. can u give me idea of doing this in server object model .. and what will be the query in this case ??

推荐答案

查看Share .NET中的示例



http://www.independentsoft.de/share/tutorial/index.html



/桑迪
Check out examples from Share .NET

http://www.independentsoft.de/share/tutorial/index.html

/Sandy


这篇关于如何使用Spquery和Caml在Sharepoint列表中插入新项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆