Changestate PDM API

Hi,
Im trying to move a file from one state to another using below code.

 oFile.ChangeState(toStateName, oFolder.ID, "Moved Programmatically", 0, EdmStateFlags.EdmState_Simple)

May I know which transition it will take and perform move? or is there any way to mention which transition it has to take and perform this action?
I noticed “ChangeState3 Method (IEdmFile13)” has option to mention transition. But it requires password which is weird.

Any idea how to move state by particular transition without password.

Thanks

Use this instead.

https://help.solidworks.com/2018/english/api/epdmapi/EPDM.Interop.epdm~EPDM.Interop.epdm.IEdmBatchChangeState.html

2 Likes

Thanks for your reply Amen Jilli. This Will it show the dialog box right? Is it possible to skip that?

@prabaharanpichaiyan you could do something like this to use the user’s response from the dialog window to determine if the state should be changed. Otherwise, if the dialog isn’t shown, the state will automatically change. You can absolutely skip showing the dialog (ShowDlg).

bool bRet = true;   // return value from shown dialog

if (showDialogWindow)
{
    bRet = _batchChanger.ShowDlg(winHandle);
}

if (bRet)
{
    _batchChanger.ChangeState(winHandle); 
}
2 Likes

You can show the dialog box but you can also skip it.

1 Like