OOF code from the documentation doesnt work

  • 3 June 2009
  • 2 replies
  • 11 views

Badge +1

Hello Everyone,


Has somone manage to work with the next lines of code :


 


WorklistShare worklistShare = new WorklistShare();


worklistShare.ShareType = K2M.ShareType.OOF;


worklistShare.StartDate = DateTime.MinValue;


worklistShare.EndDate = DateTime.MinValue;


WorkType workType = new WorkType("MyOOFWorkType");


workType.WorklistCriteria.Platform = "ASP";


workType.Destinations.Add(new Destination(@"K2:K2WORKFLOWuser1", DestinationType.User));


WorkTypeException workTypeException = new WorkTypeException("MyOOFWorkTypeException");


workTypeException.WorklistCriteria.Platform = "ASP";


workTypeException.WorklistCriteria.AddFilterField(WCLogical.And, WCField.ProcessFullName, WCCompare.Equal, @"K2OOFK2OOFProcess");


workTypeException.WorklistCriteria.AddFilterField(WCLogical.And, WCField.ActivityName, WCCompare.Equal, "Activity");


workTypeException.Destinations.Add(new Destination(@"K2:K2WORKFLOWExceptionUser", DestinationType.User));


workType.WorkTypeExceptions.Add(workTypeException);


worklistShare.WorkTypes.Add(workType);


workflowManagementServer.ShareWorkList(@"K2:K2WORKFLOWMe", worklistShare);


workflowManagementServer.SetUserStatus(@"K2:K2WORKFLOWMe", UserStatusses.OOF);


 


As you can see there is no type to K2M variable and to workflowManagementServer variable.


If someone has a custim code for managing OOF(out of office) that works or can help me with this one to work I will be really glad.


 


Ragards,


2 replies

Badge +3

WorkflowManagementServer is an instance of SourceCode.Workflow.Management.WorkflowManagementServer

I think K2M is a mistake or a namespace alias because ShareType is an enumeration from  SourceCode.Workflow.Management

I'm using the API successfully to create an out of office worklistshare, but the API however exposing technical identifier for such item, doesn't return it's right value (other than 0) to enable removing at a later time.

Hope this helps.

Badge +1

Hi gauthier,


Thank you for your attention.


I managed to make this work , there is also no connection to the workflowmanagementserver variable so it is needed to be add.


However, I pass all the lines of the code when debugging the code , everything looks nice but when I am going to look at worklist for the redirected user(the user that the tasks redirected to him) I dont see anything in his task list.


I must mention that the tasks list is a custom code that I wrote using the SourceCode.Workflow.Client DLL of course.


Can you paste here your code?

Reply