Tag Info

New answers tagged

0

By default, a lookup field contains just one value. In this case, the field value is an object of type String, and the string has the following format: Id;#Value Use int value = new SPFieldLookupValue(item["Project_x002f_Task_x0020_Status_"] as String).LookupValue to read the lookup value and int id = new ...


0

If your library is configured to require checking out files, your event receiver only fires after an item is updated which happens after item check-in. When you upload multiple documents, the event is not fired until the change is checked in. You may have more luck with the ItemUpdating. This may fire before the check-in. You can review the full list of ...


0

I faced the similar issue. In my case, I went to Site Settings -> Recycle Bin removed the app from there and then went to second stage recycle bin and deleted from there as well. After that, the event receiver fired.


0

This is as designed. It's possible that eventreceivers do not have access to current context. /* edit*/ There are some changes in SharePoint 2013. See this article: http://blog.sharepointalist.com/2013/03/sharepoint-2013-event-receiver-redirect.html In SharePoint 2010: Implement one of the eventreceiver methods in the class you created. In your case ...


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

After some experimenting based on the answer provided by C. Marius I've come to the following conclusion: If you are using ItemUpdating: public override void ItemUpdating(SPItemEventProperties properties) { if (properties.ListItem != null && properties.ListItem.ModerationInformation != null && ...


-1

-ing events e.g Item Adding or Updating are the most suitable events for validation. In your case Item Adding is the event you are looking for. In addition have in mind that this event is synchronous.


2

ItemAdding event is fired when a file is uploaded to the library. ItemUpdating is fired when custom properties in the form are saved.


0

To see a more "beautyful" error, you could enable custom errors in web.config <customErrors mode="On" /> (Help: http://social.technet.microsoft.com/wiki/contents/articles/6171.sharepoint-2010-modify-web-config-to-display-error-details.aspx) and then use this code: properties.ErrorMessage = "Error"; properties.Status = ...


0

You should use CancelWithRedirectUrl. Then show the error message on that custom page. properties.ErrorMessage = "Error"; properties.Status = SPEventReceiverStatus.CanceWithRedirectUrl; properties.RedirectUrl = url; //Pass the error message in query string Create a custom page and on Page_Load read the query string and show it in a label. ...



Top 50 recent answers are included