Skip to main content

Hi,


I have recently migrated our dev server to K2.net 2003 from K2 Blackpearl, I am facing one strange problem


we are running the app pool using one service account


now when I am trying to update the worklist details using actual user account (using k2connection.ImpersonateUser(user) it says


28019 K2:domainuser does not have permissions to update the process


and when I itry to impersonate the service account in .Net and then try to run the code I get below error


 


26030 Worklist item Server1,6407,41 not found for K2:domainserviceaccount at 10.67.0.154:633


 any idea what could be the problem? anybody faced similar issues earlier and found a resolution please respond.


Thanks in advance.


 Below is the code I am referring to


.......code to open connection to k2


.......code to open worklistitem



k2WorkListItem.ActivityInstanceDestination.DataFieldslK2ApproverVariable].Value = "somevalue";



k2WorkListItem.ProcessInstance.DataFieldsl



 



"Comments"].Value = "somevalue"




k2WorkListItem.ProcessInstance.Update();








I've used the following with some success.


            //get original user
            string oUser = WindowsIdentity.GetCurrent().Name;


            //impersonate application pool to impersonate processAdmin
            using (WindowsImpersonationContext impersonatedUser = WindowsIdentity.Impersonate(IntPtr.Zero))
            {
                using (Connection connection = new Connection())
                {
                    SCConnectionStringBuilder connectionString = buildConnection();
                    connection.Open(K2ServerName, connectionString.ToString());
                   
                    //now impersonate original user to action worklist item
                    connection.ImpersonateUser(oUser);
                    workListItem = connection.OpenWorklistItem(serialNumber);
                    connection.RevertUser();

                    //impersonate to update process data, normal users can't
                    connection.ImpersonateUser(ProcessAdmin);
                    Hashtable updateValues = buildHastable();
                    saveActivityData(workListItem, updateValues);
                    connection.RevertUser();
                   
                    //now impersonate original user to action worklist item
                    connection.ImpersonateUser(oUser);
                    workListItem.ActionstActionName].Execute();
                }
            }


 


Reply