I have tried to use an Event Receiver with ItemAdding event to set the Title field of a Document, so that when a end user uploads a document and is presented with the Edit Item page where they are forced to fill in required fields...I can populate the Title field or other fields.
I have used:
properties.AfterProperties["Title"] = "blah";
base.ItemAdding(properties);
This does not come up in the Title field in the form on the page. It is definately triggering the Event Receiver method as I've had it break on the break point.
I created my own field called "Container Record Number" with internal name "Container_x0020_Record_x0020_Number" interestingly this didn't work:
properties.AfterProperties["Container_x0020_Record_x0020_Number"] = "blah";
base.ItemAdding(properties);
but this did!
properties.AfterProperties["Container Record Number"] = "blah";
base.ItemAdding(properties);
So DisplayName seems to be the key here...and it looks like Title is doing something special in the base.ItemAdding(properties) for some reason.
Any suggestions?
ItemAdded will work by saving the "blah" into the Title but not until after the end user has clicked OK and saved the Edit Item page.