Tag Info

New answers tagged

2

Firstly there's no value for properties.AfterProperties in the ItemAdded event receiver. You can see in what receivers After- and Before- properties are available here. To get a field's value use properties.ListItem['FieldName']. To synchronize appropriate items in both lists you should have some unique field to search items. If you have Title field as a ...


1

they are already updated, thats why the event-receiver is triggered. you can get the item, on which behalf the receiver is running by properties.ListItem (properties-object is received as parameter of the method) however, if you update the item again, you have to be careful. because updating the item again of course triggers the Events again, this ...


1

As others have said, this could be because the event receiver is registered multiple times. But to me, it looks like this is happening because you have this ItemAdded event receiver registered for both the "Jawna" and the "Niejawna" lists and you're basically trying to create copies of items between the two lists. To get around this you should disable event ...


2

Disable Event Firing when you're making the update to the item. See here for an example. Make sure you don't leave the events disabled, though! Wrap the code in a try, catch, finally that ends with re-enabling the events. try { this.EventFiringEnabled = false; // Your updating code... } catch (Exception ex) { // Handle exception } finally { ...


2

From your code it seems you are using the same code for handling ItemAdded on both the lists. So what is happening is on inserting item in 1 list is inserting an item into the second list. And this invokes the event receiver in Second list. Two possibilities. You might have attached the same event receiver 5 times - You can review this using SharePoint ...


1

You're wrong asserting provider-hosted apps don't allow to handle AppInstalled event. It is absolutely possible. Refer to this documentation: Handle events in apps for SharePoint and to this sample: SharePoint 2013: Create a provider-hosted app that customizes app installation


1

If it's creation of a subsite (SPWeb) you want to catch then you can use SPWebEventReceiver.WebProvisioned But if it's a new SiteCollection then you need to stable a feature to the WebTemplate and then react to the SPFeatureReceiver.FeatureActivated


0

Not a solution for everyone but I used jslink to add a post render method for this custom list, in post render method I am refreshing page after click event on delete error message box.


0

I think This is especially the case if you have just done a retract/uninstall and you try to add straight away. If you try again in a few seconds it will work. Basically this is because when you delete a wsp from solution management and then immediately run this stsadm command, there will still be clean up operations going on in the background. So just leave ...


0

You don't need Event Receiver, rather you can do this with custom code along with your InfoPath form. Open your form template in InfoPath Design mode. Under Tools, choose Form Options -> Category -> Security and Trust -> Full Trust. Form Options -> Programming -> C# Now Drop a Button -> Properties -> Edit Form This will bring up Visual Studio Add ...


0

after-properties and before-properties doesn't work in all types of SharePoint event handlers such as synchronous and asynchronous. After properties should be used only when the event context is Item-updated event. Below code can help in disabling the subsequent events this.disableeventfiring(); //your update code.. // this.enableeventfiring();


0

You also need to set properties.Cancel = true;


0

Hi did anyone find an answer to this issue? i'm getting same thing if i upload 20 or more files, events start to fail, maybe one in every 10 fails.


0

Try enabling session affinity / sticky sessions in your NLB. You don't mention any details here. Are you on 2013?


2

You also need to set properties.Cancel = true; Your final code will look like public override void ItemAdding(SPItemEventProperties properties) { try { //my code SPListItem parentItem = oList.GetItemById(discussionId); SPListItem reply =SPUtility.CreateNewDiscussionReply(parentItem); reply["Body"] = ...


0

After many attempts, I solved as follows: I deploy it as a farm solution I run the code with SPSecurity.RunWithElevatedPrivileges


0

You can follow a different approach .Rather than specifying list id or name in ELement.xml you can specify same thing in the code public override void ItemDeleting(SPItemEventProperties properties) { if(properties.ListItem.Title="Name of your list") { using (SPWeb web = properties.OpenWeb()) { try { ...


0

There are many reasons why an EventReceiver would not fire. According to my experience, one of the sneakiest reasons is that you are using a dll from another project, but, from the same solution. And if you didn't add the assembly for when the solution is deployed the EventReceiver using it would not fire because the dll would not load. If you haven't tried ...


0

After reading a few articles I came accross that we cannot do this from Javascript, But there is a workaround, add a column to list to maintain a flag, from javascript code set it as true/ false, you can check this value in Event Receiver and evaluate the code. JAVASCRIPT CODE function updateListItem() { //your code oListItem.set_item('Flag', ...


0

Check the below code if it solve your problem. you want to update the current item metadata or other item metadata in other list or library and also does NOT need to fire another event for the other item you’ve updated. /// /// Disabled item events scope /// class DisabledItemEventsScope : SPItemEventReceiver, IDisposable { bool oldValue; ...


1

In the end I got around this issue by assigning temporary values to the required fields, updating the item, checking it in, then running the above piece of code with the addition of a check out before calling thisitem.update(), then assigning the required fields back to null. Not ideal but it works.


1

You can place code something like as below: public override void ItemAdding(SPItemEventProperties properties) { try { bool allowed = true; if (properties.ListTitle == "List A") { allowed = checkItem(properties); // Place your code for item adding for list A } if (!allowed) { ...


0

In your Event Receiver set SPEventReceiverBase.EventFiringEnabled to false while performing actions which should not trigger other Event Receivers


0

The cleanest way to solve this was in an Item Updated event receiver and with the workflow updating the item from an App Step. Chose this because setting permissions in SharePoint Designer Workflow (2013) using REST takes too many steps.


0

This is because you are Modifying the item in ItemAdded event. This basically updates the Modified By to the context of the Process which executes the event. What should change your logic to get the Modified User into a temporary object and then use that while updating the item.


0

You have DisableEventFiring in SharePoint use EventFiringEnabled = false; I am not able to understand in what context you mean to use it but yes Event firing can be disabled Check here for more details. Alternatively you can declare a boolean variable and use as below bool isEdited = false; protected override void onItemEdited(SPItemEventProperties ...


1

Try adding: context.Response.AddHeader("content-disposition", "attachment;filename=" + file.Name);



Top 50 recent answers are included