ProcessInstanceFile class

Parent Previous Next

The ProcessInstanceFile object represents a file which is part of a process instance. This class provides two main operations:

  1. Get the download url to provide the file content
  2. Prepare an upload operation to store file content


Namespace:

IYOPRO.Api

Assembly:

IYOPRO.Api (in IYOPRO.Api.dll)


Syntax

       class ProcessInstanceFile()


Members

ProcessInstanceFile(Task task, string internalname)

Constructor to initialize a GetDownloadUrl operation for a given task. The Task contains the process instance for which the file should be provided. Internalname specifies the file to download

ProcessInstanceFile(ProcessInstance pi, string internalname)

Constructor to initialize a GetDownloadUrl operation. Pi specifies the process instance for which the file should be provided. Internalname specifies the file to download

ProcessInstanceFile(string name, string path)

Constructor for an upload operation. Name specifies the displayed name of the file, path the path where the file can be located

void GetDownloadUrl(object userdata = null)

Provides the download url where the file content may be downloaded. Userdata will be provided in the GetDownloadUrlCompletedEventEventArgs

string ToString()

Overwritten method to provide a valuable string representation of the value

string Name

Gets the name of the file

string InternalName

Gets the internal name of the file. IYOPRO ensures, that the internal name is unique. Where as files with the same file names may be uploaded by different tasks of the same process instance the internal name is always different

GetDownloadUrlCompletedEvent GetDownloadUrlCompleted

The completed event is triggered if GetDownloadUrl has finished



Sample


Download sample


ProcessInstanceFile file = new ProcessInstanceFile(Task, internalname);

ProcessInstanceFile.GetDownloadUrlCompletedEvent handler = null;

handler = (s, args) =>

{

file.GetDownloadUrlCompleted -= handler;

string url = "https://www.iyopro.com/iyopro/" + args.Url;

System.Diagnostics.Process.Start(url);

};

file.GetDownloadUrlCompleted += handler;

file.GetDownloadUrl();




Upload sample


// Add the Pdf to our process instance

ProcessInstanceFile pif=Task.AddFile("My Documentation", "c:\\temp\\File.pdf");

// Add the Pdf to our process attribute, that contains the file list

List<object> files = Task.Attributes.Get("Files") as List<object>;

files.Add(pif.InternalName);

// Finish the task

Task.Run(true);