Tag Info

Hot answers tagged

9

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 ...


2

Few changes here...Add the DisabledEvents class and allow unsafe updates. Also if you set the properties.ErrorMessage, it will show in the UI if there is an issue. public override void ItemUpdated(SPItemEventProperties properties) { base.ItemUpdated(properties); try { using (DisabledEventsScope scope = new DisabledEventsScope()) ...


1

Some remarks that may help: You may have an endless loop since the call to .Update triggers itself a new update and then the Event Receiver... You may not notice it immediately since SharePoint 2013 has now a protection that stops the re-entrance after 10 occurrences... Simply add EventFiringEnabled = false; at the begin of your ItemUpdated method and then ...


1

There are two ways I can think of. Create a timer job. Schedule a SharePoint TimerJob to run daily or for every n number of hours and populate a list which will contain the excel file content. Design a Business Connectivity Service through Visual Studio and let it read data from the excel file every time it is loaded. This does not have any issue from the ...


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

Just an alternate workaround if nothing else works.Since there is no built in method which mimics this.EventFiringEnabled the only way is to set a flag outside this item which will enable us to know whether the current update event is called by a genuine update through browser or external code or from an update called from an update event. Create another ...


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

Can't you use the "Link to Document" content type ? This means you could have one copy of the SOP and then have a series of Links to it in your other libraries. I also blogged about this : http://www.collaboris.com/blogs/collaboris-blog/policy-management/2013/04/03/use-a-link-to-a-document-in-place-of-an-real-document-in-sharepoint#.UtH_3PTrwdU


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