EPDM file change state

Hi all

i am trying to change the state of a file using the relevant API in C#

// 1) Getting the IEdmFile5 object reference (p_name is the actual path in the vault and it is not null). The file is checked in by some API calls and it has

//  no current  state set (l_file.CurrentState="")

l_file = g_edm_vault.GetFileFromPath(p_name,out l_parent);

// 2) Changing the state to an existing one (I checked the existence in EPDM Administration/Views//Workflow)

object l_obj ="Released";

l_file.ChangeState(ref l_obj,l_parent.ID,"Approvato da procedura MB_setup",g_frm_hnd,

(int)EdmStateFlags.EdmState_Simple);

The ChangeState call fails telling that there no such state. Reading the manuals I discovered that there must be a Transition State from the CurrentState (which is "")  and the new state. But there is no way to create a state with no name and therefore i cannot set any state although existing

What i can do? Is there a way to enforce a specific state during the checkin operation?

thank you

best regards

neri alamanni

SolidworksApi macros