How to load a K2 5 kprx into a Persistable Object?

  • 17 July 2018
  • 1 reply
  • 3 views

Hi,

Anyone have idea to load K2 5 kprx into PersistableObject?

 

I have try to get a PersistableOject using "Load" method of  SourceCode.Framework.SerializationInfoProvider  with memory Stream of K2 Five kprx.  see below source code.

static void Main(string[] args){       byte[] x = GetProcessSource(@"C:Usersk2adminDocumentsK2 5 kprxKprxUpdateSubSiteByGetRefProcess_K2Five.kprx");using (var serializer = new SerializationInfoProvider())            using (var stream = new MemoryStream(x))            {                if (stream != null)                {                                       PersistableObject pot =(PersistableObject)serializer.Load(stream);                                   }            }} public static byte[] GetProcessSource(string fileName)        {            try            {                // Read the file as byte                byte[] kprxBytes = File.ReadAllBytes(fileName);                // Return the KPRX bytes                return kprxBytes;            }            catch            {                throw;            }        }

I am getting  following Exception on

 

PersistableObject pot =(PersistableObject)serializer.Load(stream);

above line.

 

Exception : "Exception has been thrown by the target of an invocation."

12339iF2CECEB945565DE3.png


Note : Above Sourcecode is successfully works for K2 4.7 kprx.  but not working for K2 5 kprx.


Any one have Idea regarding this?

Thanks & Best regards
Kajan


1 reply

Badge +7

Hi Kajan_Ceymplon,


 


Thanks for asking this question here on the community forum. I realize it's been a while since you asked this question, but I guess the community was pretty stumped with the question you asked.


 


Did you manage to resolve your issue in the meantime by other means?


 


If not, then in order to help you here, I'd just like to get some clarity on the issue you describe.


 


Why are you trying to "Load" a K2 Five Workflow KPRX file into a C# application using the PersistableObject class?


 


What is the end result of this project supposed to be? Do you want to automate the deployment of workflows somehow? Does this have to do with keeping track of Version Control like in TFS/Git?


 


Maybe adding some screenshots to this post would help clarify what you're trying to do.


 


Thanks and kind regards,
ChrisW

Reply