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 have a scenario where I need to update a list item, but I don't know the internal ID of the list item - hence the following won't work for me:

batchElement.InnerXml = "<Method ID='1' Cmd='Update'>" +
            "<Field Name='ID'>" + id + "</Field>" + 
            "<Field Name='DeliveryStatus'>" + newStatus.ToString() + "</Field></Method>";

Instead I have another field in the list called ProcessID:

So I would like to update the delivery status where ProcessID = X

Is this possible using SharePoint web services.

One solution I was thinking of is to first do a select for the ID based on the ProcessID - then update based on this ID, but this seems like a crazy solution, surely the inventors of MOSS CAML would have provided a way to update a list item by some means of a where clause, or using another field for filtration rather than just plain old ID?

Thanks

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

I suspect that you're crazy solution is the right one - select for the items to get the IDs, then update.

It's not much different to uploading a document - that can involve an HTTP PUT, setting the metadata, and then checking the item in - that's 3 HTTP requests for what I though should be 1...

share|improve this answer
add comment

I think you are missing a few nodes. You should need the following:

<updates><Batch OnError='Continue'>{CAML}</Batch></updates>
share|improve this answer
    
@Mike - thanks my batch element contains this, but I am in search of a way to update a list item based on a field other than id, any idea how this is done? –  user879 Jun 4 '10 at 3:49
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.