OnInitializeDocument : HandlingCode doesn't work

OnInitializeDocument : HandlingCode doesn't work

alder_moriggi
Enthusiast Enthusiast
313 Views
1 Reply
Message 1 of 2

OnInitializeDocument : HandlingCode doesn't work

alder_moriggi
Enthusiast
Enthusiast

Hi all, in .net I would like to intercept the file creation on "OnInitializeDocument" event and undo operation (or confirm) in a certain conditions.
I set the "HandlingCode" parameters (HandlingCodeEnum.kEventCanceled or HandlingCodeEnum.kEventHandled) but in both cases it creates the file.
Anything else to set? What's wrong?

 

TIA

Alder

 

Private Sub m_appEvents_OnInitializeDocument(DocumentObject As _Document, FullDocumentName As String, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, ByRef HandlingCode As HandlingCodeEnum) Handles m_appEvents.OnInitializeDocument
Try
...

If Cancel_Event then
HandlingCode = HandlingCodeEnum.kEventCanceled
Else
HandlingCode = HandlingCodeEnum.kEventHandled
End If
Catch ex As Exception

End Try
End Sub

0 Likes
314 Views
1 Reply
Reply (1)
Message 2 of 2

YuhanZhang
Autodesk
Autodesk

Hi Alder,

 

Please refer to the documentation for the event:

 

https://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=GUID-EDA1CDB1-0BF3-46CD-8535-DDA6D973EAC2

 

The HandlingCode is ignored for this event, so you can't use this event to cancel the operation.

 

Can you explain what you want to do? What is your workflow and why you need to cancel the document opening?



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes