Exporting process through API [Resolved]

  • 1 February 2006
  • 4 replies
  • 3 views

Badge +7
Hello,

I'm developping a little app to export processes (instead of using
K2 Studio)

Here is my code

[quote user= new XmlDocument();

doc.Load(fullPath);

Export expt = new Export();
expt.Xml = doc.OuterXml;

K2Manager k2m = new K2Manager();
k2m.Login(exportServer,5252);
k2m.Export(expt);



using K2Manager API. the xmldocument contains the export xml file.

The export seems to work a little since I can see a new process version but in fact, the process starts but does not reach the first activity (it is in state "Running" but not "Active")...

In help doc, I saw the method AddReference in the Export class but don't know how to use it. Maybe I need it to completely success in process export

Does anyone can help me?

4 replies

Badge +6
Hi TanguyALSY,

Yep I recently wrote a similar command line export tool and my approach used the K2Studio API to do the export. That will take the solution file and export it to one of the export servers defined for that project.

I am sure you can do it with the K2Mng API too, but like you said you need to do the AddReferences manually and I'm not too sure how to do that. I would suggest to just use the K2Studio API if you can...
Badge +7
Thanks for your response...

Unfortunately, when I used the K2Studio API, I get an error message saying that the CLSID {...} is not valid or either not registered and I don't know what to do...
Badge +7
Here is the exact error message I get : "COM object with CLSID {7744D881-7133-43BA-A295-98658186B7C0} is either not valid or not registered."

GLouw, could you please post the part of code you used to export the process to be sure I did"nt forget anything...

Thanks
Badge +7
Ok I get it...

In fact I didn't instanciate K2studio application, solution, etc...


So the final code is :


public bool exportProcess(string fullPath,string exportServer, ref string result)
{
try
{
K2Studio.ApplicationClass app = new K2Studio.ApplicationClass();
app.Solution.Open(fullPath);

K2Studio.Process proc = app.Solution.Projects.Item(0).ProcessFolder.Processes.Item(0);

return proc.Export(exportServer,ref result);
}
catch(Exception error)
{
throw new Exception(error.ToString(),error);
}
}

Reply