更新列表项 [英] Update a list item

查看:70
本文介绍了更新列表项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi,

我正在尝试在此处更新列表项的值.我知道该行的ows_id是913.但我不确定

I am trying to update the value of a list item here. I know the ows_id of the row which is 913. But I am not sure

$ id是什么.这是该字段的ID吗?我不确定如何获取商品的ID.我缺少什么?

what $id is. Is it the id of the field ? I am not sure how to get an item's id. What am i missing ?

$ xmldoc = new-object system.xml.xmldocument $ batchelement = $ xmldoc.createelement("batch") $ batchelement.setattribute("onerror","continue") $ batchelement.setattribute("listversion","1") $ batchelement.setattribute("viewname",$ listview.childnodes.item(1).name) $ id = 1#这是什么? $ rowId = 913 $ xml =<方法ID = $ id Cmd ='更新'>"; + <<字段名称='ID'> $ rowId</Field>" + <<字段名称='My_x0020_Special_x0020_Counter'> 0</Field>" + </Method>"

$xmldoc = new-object system.xml.xmldocument $batchelement = $xmldoc.createelement("batch") $batchelement.setattribute("onerror", "continue") $batchelement.setattribute("listversion", "1") $batchelement.setattribute("viewname", $listview.childnodes.item(1).name) $id = 1 # What is this ? $rowId = 913 $xml = "<Method ID=$id Cmd='Update'>" + "<Field Name='ID'>$rowId</Field>" + "<Field Name='My_x0020_Special_x0020_Counter'>0</Field>" + "</Method>"

$ batchelement.innerxml = $ xml           
尝试{           
    $ returnvalue = $ service.updatelistitems($ listname,$ batchelement)            
}

$batchelement.innerxml = $xml            
try {            
    $returnvalue = $service.updatelistitems($listname, $batchelement)             
}

有一个异常.

谢谢

Mohan


推荐答案

请查看博客以获取解释

Please check blog for explanation

http://mysharepointwork.blogspot.in/2010/09/addupdatedelete-list-items-using.html

http://mysharepointwork.blogspot.in/2010/09/addupdatedelete-list-items-using.html

致谢

Prasad Tandel

Prasad Tandel


这篇关于更新列表项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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