I want to subscribe to the event UnifiedFileAdded (this might be wrong and there might be another event or something I need/want, but what I want is to know when a file are FINISHED uploaded and accepted by the user), and this kind of works as expected. Or more precisely the subscribtion works. And the event fires.
But:
When are actually the file 'Added'?
When the file is written to disk? If the file is new it is fine and works ok.
But what if the file already exists?
And especially what if the user press cancel to overwrite?
Are the file still 'Added'? The event has fired long before the user presses cancel on overwrite so according to the event the file are added, but according to the disk the file has not been added at this moment.
A little bonus here is that if the file already exists then UnifiedVirtualPathEventArgs.NewVirtualPath are pointing to a temporary file. This would be fine when accessing the Adding-event, but not when accessing the Added-event.
Is this by design? And if yes: How may I then trapp when a file _actually_ are added without subscribing to windows events, or making strange constructs with Scheduler-services doing stuff with folders at specified times?
I guess that you refer to the VirtualPathVersioningProvider
In that case you should take a look at the events
UnifiedFile.UnifiedFileCheckingOut
UnifiedFile.UnifiedFileCheckingIn
UnifiedFile.UnifiedFileUndoingCheckOut
UnifiedFile.UnifiedFileCheckedOut
UnifiedFile.UnifiedFileCheckedIn
UnifiedFile.UnifiedFileUndoedCheckOut