Category Archives: K2 smartobjects

K2 ServiceObject with File Property

Some code snippets to help

FileProperty fpropData = new FileProperty("FileData", new MetaData(), String.Empty, String.Empty);
fpropData.MetaData.DisplayName = "File Data";
fpropData.MetaData.Description = "File Data";
this.Properties.Add(fpropData);
public static object ToFilePropertyValue(string propName, string filename, byte[] content)
{
  return (new FileProperty(propName, new MetaData(), filename, Convert.ToBase64String(content))).Value;
}
dr["File"] = Helper.ToFilePropertyValue("File", "foobar.dat", {foobar byte[]});