When a user is creating a new document by selecting "new" on a document library it should be possible via an event trigger to call some custom code that will update the document attributes. As far as I know this can't be done through the SPList events as ItemAdding will not be triggered when the document is created, but when the document is saved later on. Will the Content Type events be the way to implement the requested functionality?
|
I take it you are talking about SharePoint 2007 (please tag post accordingly:-) Depending on what you want to achieve, hook into the ItemAdding, ItemAdded, ItemUpdating or ItemUpdated event. All will be called as the provisioning process includes updating meta data for the document. If you have enabled checkin/checkout i think the update events will fire twice, but Im not 100% on that as its been a while since I ran into that problem. For the same reason remember to disable event firing in a try/finally: If you choose update events, remember that the logic will also fire when you later update the item. To distinguish look in the BeforeProperties or AfterProperties for evidence of what the source of the event is (there is some vti_something fields that will give evidence what caused the event to fire). Im not on my box right now so I cant test the above, but anyone feel free to add on the above and correct me if im wrong :-) |
|||||||
|