Note that there are some explanatory texts on larger screens.

plurals
  1. POsharepoint splistitem.Update fails
    primarykey
    data
    text
    <p>I have the following code:</p> <pre><code>using(SPWeb web = ... { .... SPListItem item = GetItemById(id); item["Status"] = status; item["Reason"] = reason; item.Update(); } </code></pre> <p>And I got an exception "Cannot complete this action"... however, trying to figure it out, I noticed something... weird...</p> <p>I put a breakpoint exactly in the line item.Update()... while debugging I let the exception to happen, and then I went to my Watch window and put there "item.Update()"... the item was updated...</p> <p>Then.. I started all over again, but, this time, I tried "item.Update()" in the watch window, an exception was thrown.. then I press F10 to execute my code, and for my surprise it successfully updated the item..</p> <p>I have tried this over and over, and always is the same... so, for some weird reason, the first time it's failing and the second one is good.. does anybody know why?</p> <p><strong>EDIT:</strong></p> <p>I've tried this:</p> <pre><code>SPSecurity.RunWithElevatedPrivileges(delegate() { .... item.Update(); }); </code></pre> <p>But, it still fails, now with the exception: "Operation is not valid due to the current state"...</p> <p><strong>EDIT 2:</strong></p> <p>this is moss 2007, it is a web application (asp.net) connecting to a sharepoint site, both columns exist.. </p> <p>I've found another thing.. if I put a breakpoint in item.Update(), and I press F10, it works.. the item is updated..and no exception is thrown... but in normal excecution, it always fails.. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload