0

I'm trying update list item created by workflow, using code below. But it did not work. What I am doing wrong?

public override void ItemUpdated(SPItemEventProperties properties)
        {
            base.ItemUpdated(properties);

        SPList Listcurrent = properties.Web.Lists["Tasks"];
        SPListItem taskid = Listcurrent.GetItemById(properties.ListItemId);

        taskid["%5Fx041d%5F%5Fx0430%5F%5Fx0437%5F%5Fx0432%5F%5Fx04"] = "Hello World!";               

         taskid.Update();

Any help would be appreciated!

7
  • taskid["columnname"], is "%5Fx041d%5F%5Fx0430%5F%5Fx0437%5F%5Fx0432%5F%5Fx04" this your column name ? Jun 16 '16 at 11:47
  • you can debug your event receiver and then share the error. Jun 16 '16 at 12:00
  • Do you want to update the same item?
    – Hardik
    Jun 16 '16 at 12:39
  • Hardik, yes the same as in properties
    – Denis
    Jun 16 '16 at 13:00
  • Akarsh Gupta, yes its the name displaying in browser after "&Field="
    – Denis
    Jun 16 '16 at 13:02
1

The solution of update problem.

The code does not work whith field name "%5Fx041d%5F%5Fx0430%5F%5Fx0437%5F%5Fx0432%5F%5Fx04".

But"strange" name of the field is correct. The reason- russian letters in the field name.

To solve this problem decode field name to internal name. How to get it?

Go to this blog

And then decode field name in "URL Encoder And Decoder Tool" unit.

For me internal name is "_x041d__x0430__x0437__x0432__x04".

And new code will be, and it works:

taskid["_x041d__x0430__x0437__x0432__x04"] = "Hello World!";               

taskid.Update();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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