K2.ProcessInstance.Originator.Name will always return the user's AD login name (domainusername), there is no configuration setting to change this behaviour.
If you have the user's login name, you can use the DirectoryServices .NET namespace to pass a query to AD to return the user's displayname. The following code snippet is an example of how to do this:
.ToString();
}
else
displayName = "";
}
return displayName;
}
}
you will need to decide when you want to retrieve the user's displayname - you could capture it as part of process instance data when the user starts the process, or you can use code within a K2 server event to retrieve the user's displayname.
If you are using a server event, there is a neat trick to get the LDAP path that has been set in the K2Server.config file, as the following code snippet demonstrates:
string adPath = "";
SourceCode.K2Utilities.DSHelper ds = new SourceCode.K2Utilities.DSHelper((SourceCode.K2Utilities.DSHelper.DSHelperNewOptionsEnum)0);
adPath = @"LDAP://" + ds.GetDefaultLDAPDomain();
You can then pass this ADPath to the DirectoryEntry object in the previous code snippet.
Hope this helps