I have a document library in which I have attached two event receivers.
- Item Added.
- Item Updated.
My event receiver definition is:
<Receiver>
<Name>ReceiverItemAdded</Name>
<Type>ItemAdded</Type>
<Assembly>XXX</Assembly>
<Class>XXX</Class>
<SequenceNumber>10000</SequenceNumber>
<Synchronization>Synchronous</Synchronization>
</Receiver>
The event receivers simply copies the item and metadata to other document library.
The event receivers work fine if I upload the document from SharePoint. But the Item Added event receiver does not work if I upload multiple files using explorer. The destination file shows the 0 KB size, but the metadata is copied successfully.
The code which copies the file is as below:
// Copy File
SPFile newFile = destLibrary.RootFolder.Files.Add(addedItem.File.Name, addedItem.File.OpenBinary());
SPListItem newItem = newFile.Item;
newItem[FieldNames.ImagesId] = addedItem[SPBuiltInFieldId.ID];
newItem.Update();
It is must to solve the issue as users would use the explorer to upload the file. Where is the point that to be caught in the code which will trigger Item Added event receiver if file is uploaded using explorer.
Please help.