3

I have a form library with a custom form associated. A user clicks "New form", inputs data in the form, and the form is saved to the library. Meanwhile, my logic in the eventreceivers generate a Word document and saves it to another library.

ItemAdded takes in a SPItemEventProperties properties object. It then uses properties.ListItem.File to get the data from the form.

This works the first time a document is created after the event receiver/solution is deployed. The SPFile has a length of 3k, and after I open it in binary it has an array of length 3k.

The second time and from then on, the SPFile object is not fully "saturated". The length-property of the file is 0, and the binary stream of the property yields an empty array. However, the File is not null, it has the correct name etc., just no content!

How could this be?

1

I solved the problem. The problem was that the ItemAdded didn't have full File information in the properties object (This is spesific for Doc. Libraries).

Since ItemUpdated always runs after ItemAdded, I just applied my logic there instead, because the File object is always correct in ItemUpdated apparently.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.