Using "Copy to" on document to copy it to the same library overwrites addin actions

Copper Contributor

Hi!

 

Hope someone can help me with this problem we have... ;)

 

We have a custom addin, which generated a number for a document during the ItemAdding remote event receiver. When we add a document, it gets a number, let's say 001. When we use "Copy To" to copy the document to another location (another library or site), the copied document gets a new number, let's say 002. This is as expected.

However, when we copy the document this way to the current library, the new document gets the same number as the original document, which is 001. It should have been 003 now...

In the log file of our addin application, we can see that in every scenario, our addin software generates and assigns the newly generated number. However, the document has number 001 instead of 003.

What we've tried:

1. We have tried to copy the document to another folder within the same library. That has the same invalid result (same number as original).
2. We disabled the ItemAdding event receiver and enabled the ItemAdded event reveiver. In this case, the document that is copied to the same library as the original, gets a new number. So, this is good.

3. Restoring the ItemAdding event, we tried to set the remote event receiver's sequence to 10000, but that doesnt change anything.

 

So it looks like copying to the same location causes SharePoint to overwrite new property values from the ItemAdding event receiver with the property values of the original document. While this is not the case when the document is copied to another location.

 

We need to be able to use the ItemAdding event. Does anyone have any clue what's going on here? Or how to solve this?

 

All help is very much appreciated! Thanks in advance.

 

Cheers,

Ruud Hunnekens.

0 Replies