Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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