out of office K2 API

  • 29 May 2013
  • 6 replies
  • 17 views

Badge +3

hi all,


 


i want to create worklist sharing when user is out of office in some period of time


i'm trying to using the example here http://help.k2.com/en/k2devref.aspx?page=How_to_set_a_users_Out_of_Office_Status.html


 


but i get an error when calling this method

Normal
0




false
false
false

IN
X-NONE
X-NONE











MicrosoftInternetExplorer4




























































































































































connection.ShareWorkList(@"K2:DOMAINSharer", worklistshare);


 


the error is like this "The User does not appear to be managed by the connection user"


 


btw i'm using K2 4.5 kb 1370


 


6 replies

Badge +8

When using the SourceCode.Workflow.Client API, you must open the connection either as the user itself, or a manager of that user. If you want to be able to set the Out of Office for users as an Administrator, you will need to use SourceCode.Workflow.Management API.

Badge +3

so i just need to impersonate it first then?


 


i'll try it as soon as possible :)


 


btw DC i read from help that the time start and end still not working in OOF?


is it true that we need to manualy set up when user go OOF and Active again despite we already set the start date and end date?


 


thx

Badge +3

Dear DC,


 


i already using impersonate user to try to solve this


the connection is already with share user but still getting the same error here :(


 

Badge +8

Could you post your complete code snippet so we can have a look?

Badge +3

Searching again in k2 underground i have found this


http://www.k2underground.com/forums/p/10570/31335.aspx


 


it work for me in home workspace there's sign for OOF but in workspace when i open setting it won't set out of office but still in the office


and the user to share is not added there and the worklist is not moved to :(

Badge +8

I tested the sample code in the link and it worked OK for me. I.e. the OOF user can see the status and the config in Workspace's Worklist. The delegate is also able to see these items. Just a note, I tested this on 4.6.5, I don't have a 1370 image offhand.


WFC.Connection wfcon = new WFC.Connection();


wfcon.Open("localhost");
wfcon.ImpersonateUser("K2:DENALLIXMike");
WFC.WorklistShare worklistShare = new WFC.WorklistShare();


worklistShare.ShareType = WFC.ShareType.OOF;
worklistShare.StartDate = DateTime.MinValue;
worklistShare.EndDate = DateTime.MinValue;
WFC.WorkType workType = new WFC.WorkType("MyOOFWorkType");
workType.WorklistCriteria.Platform = "ASP";
workType.Destinations.Add(new WFC.Destination(@"K2:DENALLIXAnthony", WFC.DestinationType.User));


WFC.WorkTypeException workTypeException = new WFC.WorkTypeException("MyOOFWorkTypeException");
workTypeException.WorklistCriteria.Platform = "ASP";
workTypeException.WorklistCriteria.AddFilterField(WFC.WCLogical.And, WFC.WCField.ProcessFullName, WFC.WCCompare.Equal, @"K2OOFK2OOFProcess");
workTypeException.WorklistCriteria.AddFilterField(WFC.WCLogical.And, WFC.WCField.ActivityName, WFC.WCCompare.Equal, "Activity");
workTypeException.Destinations.Add(new WFC.Destination(@"K2:DENALLIXCodi", WFC.DestinationType.User));
workType.WorkTypeExceptions.Add(workTypeException);


worklistShare.WorkTypes.Add(workType);
wfcon.ShareWorkList(worklistShare);
wfcon.SetUserStatus(WFC.UserStatuses.OOF);

Reply