Closing a specification

I need to close a specification in a program. For example I open a master model part X, then create a specification in TC using part X as the master model. I create a CGM from this spec without saving it. I want to close this part X and the spec without saving it.

this does not work

Dim partclose As NXOpen.UF.UFPart
ufs.Part.Close(this_part, Nothing, Nothing)

workPart.Close(BasePart.CloseWholeTree.False, BasePart.CloseModified.UseResponses, Nothing)

I don't have Teamcenter to test with, but this works with native to close the display part without saving...


Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work

Dim displayPart As Part = theSession.Parts.Display

displayPart.Close(BasePart.CloseWholeTree.True, BasePart.CloseModified.UseResponses, Nothing)

workPart = Nothing
displayPart = Nothing

End Sub
End Module