K2.ActivityInstanceDestination.User.Email is Empty with custom security label?

  • 30 June 2011
  • 0 replies
  • 2 views

Badge +5


I have implemented a custom security provider and I'm trying to get the destination user's email address in a client activity. I have tested the security provider with the following unit test and the test is  successful: 


 


        private static UserRoleManagerServer OpenRoleManager()


        {


            var connBuilder = new SCConnectionStringBuilder


            {


                IsPrimaryLogin = true,


                Host = "My K2 Server",


                Port = 5555,


                Authenticate = true,


                SecurityLabelName = SecurityLabel,


                UserID = UserName,


                Password = Password,


                Integrated = false


            };


 


            var roleServer = new UserRoleManagerServer();


            roleServer.CreateConnection();


            roleServer.Connection.Open(connBuilder.ToString());


            return roleServer;


        }


 


[TestMethod] 


public void GetUserTest() 



    var roleServer = OpenRoleManager(); 


    try 


    { 


        var resUser = roleServer.GetUser(@"LABEL:XYZ estuser", SecurityLabel); 


        Assert.IsNotNull(resUser, "GetUser returned null"); 


        Assert.IsNotNull(resUser.Properties, "Properties value is null"); 


        Assert.AreEqual("Test", resUser.Properties["FirstName"], "Incorrect FirstName"); 


        Assert.AreEqual("User", resUser.Properties["LastName"], "Incorrect LastName"); 


        Assert.AreEqual("test.user@xyz.com", resUser.Properties["Email"], "Incorrect Email"); 



finally 



    roleServer.Connection.Close(); 


    roleServer.Connection.Dispose(); 




 


Inside the client activity I am using the following code to get the user's email address: 


K2.ActivityInstanceDestination.User.Email 


However, this returns an empty string, even though I am targeting the same user. I am able to get the correct values for K2.ActivityInstanceDestination.User.FQN and K2.ActivityInstanceDestination.User.Name, but Email is empty. 


 


I have tested with AD and the code to get the email address works. 


 


Thanks in advance.



0 replies

Be the first to reply!

Reply