Tag Info

Hot answers tagged

8

I hade the exact same problem last week and found no built in way of solving it. What I ended up doing was checking the value of beforeProperties and afterProperties of what I wanted to update, and if there was no difference, then I broke out of the method. I actually wrote a blog post about it. This is an annoying problem that I hope Microsoft improves in ...


2

You probably have your event receiver registered twice. Use PowerShell to find out. $site = Get-SPSite http://myportal.com $web = $site.OpenWeb("/path/to/my/site") $list = $web.Lists["The List"] $list.EventReceivers | Select Type, Class | Order Type, Class


2

Disable event firing before you Update your item. this.EventFiringEnabled = false; item.Update(); this.EventFiringEnabled = true; Note that this might cause problems when item.Update() throws an exception, leaving your eventfiring off.. you can use a try/catch to solve this. hope I could help : )


2

I believe the solution lies here. You need to ensure the ItemUpdated event runs synchronously rather than async. The ItemUpdated event by default will run after the page has already posted back and does not have a connection to the HttpContext of the firing page. ItemUpdating should have a connection, but marking it as synchronous might help.


2

The solution is to use SPItemEventReceiver.EnableEventFiring MSDN You can do var eventRecTemp = new SPItemEventReceiver(); eventRecTemp.EnableEventFiring = false; //update eventRecTemp.EnableEventFiring = true; or as this blog talks about, turn it into a scope using IDisposable. I used the scope method in an ItemUpdated heavy project and it worked well. ...


2

RWEP is not available in the sandbox. Your alternative would be to grant a custom permission to the location where you are moving files to that grants the user Add Items or create a full trust proxy. For permissions, in your event receiver, you move the file normally. Users cannot modify items, users cannot delete items, only add new files. Fills the gap ...


1

In the ItemUpdating ER the value properties.AfterProperties["vti_contenttag"] is null when the doc is added, overwritting another one. This could be a way to go, not the best for sure, but still a working solution


1

this.EventFiringEnabled = false; is used in Server object model. However, there doesn't seem to be its equivalent in Client object model. So the alternative is to check the field value first before making any changes to avoid the update operation recurrence. See similar question here: ...


1

Try checking the item.AfterProperties or the item.AfterUrl. It's weird that you can't get the item by using its UniqueId, but you have to check other things as well. Is item in your case properties.ListItem, where properties is of type SPItemEventProperties? If not, that could also be the culprit as you should work with the item passed into your event ...


1

I have not personally run into this issue but it sounds a lot like an unsafe update error. Assuming properties.ListItem is a reference to the newly moved file and not null or somehow have a reference to the old file location, you can try something like this: movedFile.Web.AllowUnsafeUpdates = true; movedFile.Update(); movedFile.Web.AllowUnsafeUpdates = ...


1

What about checking out file before modifying properties? You check if file is available: if true, you check out file, do changes and check it back in. if file is already checked out you just wait (random amount of time) and then get file status again - after this you have available file or wait again. There is no need to modify the file, but you can use ...


1

This worked. item["VerifiedBy"] = web.EnsureUser(MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/m‌​‌​y:grpDaa/my:CheckedBy/pc:Person/pc:AccountId", NamespaceManager).Value);


1

Compare the values of your Current Item's Created column and Modified column in your workflow. If the two datetime values are equal, your Current Item is newly created. Else, your Current Item's been changed.


1

You should try to use the ItemUpdating instead of the itemupdated event. In the itemupdated event, there aren't any before and after properties! Only while updatING...



Only top voted, non community-wiki answers of a minimum length are eligible