Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I got a custom Sharepoint list which has the following list items

Hostname  -   IP   -     OS     -    CPUs - RAM -    Disk

Server      1.1.1.1   Server 2003     3      8    Disk C: 20gb

If i then change, lets say, the RAM so there is now 12gb (or CPU or any of the other values) i would like it to update it)

I got scripts that pull all the information from the servers via WMI and exporting it to a .csv

The csv layout looks like the following

IP,Hostname,OS,CPU,Ram,Disk
1.1.1.1,Server,Server 2003,3,12,Disk C: 20gb

Now here's the real question, i got a script that add's the items to the list, but if i run it again it adds the item to the list so its now there twice, (one with the old value and one with the new) but i need a script that can update the diffrent column values if they should change, without having to remove the item and add it again with the new values.

share|improve this question
    
How about share your script or at least give us the absolute basic info needed to help you out - how are you updating SharePoint? SharePoint OM, Client OM, Web Services, Power shell or something else? –  Ryan Dec 8 '11 at 15:15
    
I tagged it as Powershell so thats what im using –  Casper Dec 9 '11 at 11:47
add comment

1 Answer

up vote 1 down vote accepted

You need to know the item ID you are updating, supposing you are using powershell (the tag you have put), it is like that: Let's assume your list name is Servers

$site = new-object Microsoft.SharePoint.SPSite(spserver)
$web = $site.OpenWeb()
$spList = $web.Lists["Servers"]
$serverItem = $spList.GetItemByID(1)
$serverItem["RAM"] = 12
$serverItem.Update()

In the GetItemByID methof you must put the correct ID of an item that you wish to update.

If you have your own identifier - let say you know that IPs are unique, you'll need to select item by that field, using CAML query.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.