Session class

Parent Previous Next

The creation of a Session object is always the first step in the communication between a client application and the IYOPRO back-end. It is required for all following API calls and objects.  


Namespace:

IYOPRO.Api

Assembly:

IYOPRO.Api (in IYOPRO.Api.dll)


Syntax

       public class Session(string serviceurl, string username, string password)


Members

Session(string servicepath, string username, string password)

Initializes a new instance of the Session class. The servicepath specifies the location of the IYOPRO backend webservice. For the SaaS version of IYOPRO you must specify
 https://www.iyopro.com/iyopro/

Username and password represent the credentials which where used on user registration.

void Login(object Userdata=null)

Performs the Login process. You may provide user data which will be provided in the resulting LoginCompletedEventEventArgs

void Login(Guid sessionId,object Userdata=null)

Validate session id. Perform this operation to validate if a previously received session is still valid

void AutoLogin(object userdata = null)

Perform automatic login. This methode uses NTLM to perform the login at the IYOPRO Server

bool IsLoggedIn()

Returns true if the user was logged in, false otherwise. this method does not verify if the session is still valid

void Logout()

Performs the Logout process.

string GetServiceUrl()

Gets the service URL that is used to connect to IYOPRO

string GetNtlmServiceUrl()

Gets the service URL that is used to connect to IYOPRO with NTLM credentials

void GetProjectTasks(int workflowid, object userdata = null)

Read all tasks of a workflow definition which are marked as project task

void CreateWorkflow(ProjectTasks tasks, Roles roles, object userdata = null)

Creates a workflow from a given hierarchy of tasks, and roles

string UserName

Gets the user name which was specified in the constructor.

string ServicePath

Gets the service url  which was specified in the constructor.

Guid SessionId

Gets the session id which is provided by the Login() method.

Workflows Workflows

Gets a reference to the Workflows class which provides managing workflow objects.

Tasks Tasks

Gets a reference to the Tasks class which provides managing Task objects.

ProcessInstances ProcessInstances


LoginCompletedEvent LoginCompleted

The LoginCompleted event is triggered if the Login has finished.

GetProjectTasksFinishedEvent GetProjectTasksFinished

The GetProjectTasksFinished event is triggered if GetProjectTasks has finished.



A typical way to log in is

  1. Verify if a previously received sessionid is still valid To do this use
    void Login(Guid sessionId,object Userdata=null)
  2. If the sessionid is not valid try AutoLogin
    void AutoLogin(object userdata = null)
  3. If Autologin failed ask for Username and password and perform a manual login
    Session(string servicepath, string username, string password)


Sample to log in

Session session = new Session("https://www.iyopro.com/iyopro/" , "username" , "password");

session.LoginCompleted += (s, args) =>

{

if (args.Error != null)

{ string msg=args.Error.Message;

 MessageBox.Show(msg);

 return;

}

};

session.Login();