El archivo ha sido modificado por error en sharepoint

I am getting the following error when i try to update the item's name in the sharepoint document library. The item is of type document set and its default values is loaded using javascript. In the Item added event we are updating with the new changed item's name value. But in the item.update() code statement i am getting following error.

The File CZY14389 has been modified by domain\username on current date.

Please provide your commens on resolving this.

preguntado el 24 de agosto de 12 a las 07:08

4 Respuestas

You cannot change the name of a sharepoint document like that. You need to "move it".

Item.File.MoveTo(Item.ParentList.RootFolder.Url + "/" + newFileName, false);
Item.File.Item["FileRef"] = newFileName;

Respondido el 04 de Septiembre de 12 a las 16:09

before you update item name and call item.update(), can you try to refresh your item like this:

 item = item.ParentList.GetItemById(item.ID);
 item.name = "xyz";

Respondido 27 ago 12, 00:08

this can sometimes happen in event handler. the problem is the updation process in the event handler is not as the same of the workflow. In event handler for updating you have to use the followitn steps. Dont use Item.Update() as in workflow.

Sigue los pasos:

• call and disable event firing before your code with : base.EventFiringEnabled = false;

•update your item by calling item.systemUpdate(false);

•enable event firing with : base.EventFiringEnabled = true;

respondido 29 nov., 12:10

Disable event firing and call your update code, dont forget to enable event firing.

     HandleEventFiring handleEventFiring = new HandleEventFiring();  
//if item.Update  doesnt work then use(For me item.update worked only on my local not on prod then i used the below)  

 public class HandleEventFiring : SPItemEventReceiver  

        public void DisableHandleEventFiring()  
            this.EventFiringEnabled = false;  

        public void EnableHandleEventFiring()  
            this.EventFiringEnabled = true;  

respondido 26 mar '15, 18:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.