This project has moved. For the latest updates, please go here.

UserAccountDomain and UserName NULL when ConnectedDomain and ConnectedUser have values

Topics: Errors
Feb 17, 2015 at 4:30 PM

I have started using this managed wrapper but came into this weird problem. When I have tried to Register the Task using the UserAccountDomain and UserName properties from the Task Service which is previously instantiated with a Machine, Domain, UserName and Password, I saw that both properties are holding null value.

Whereas, the deprecated properties ConnectedDomain and ConnectedUser are showing the values properly. Any idea?

I'm using version where the run time version in v4.0.30319.


Feb 17, 2015 at 6:13 PM
This is by design and relates to serialization. The UserAccountDomain and UserName properties will return null if they match the current user that is executing the library.
Feb 18, 2015 at 11:50 AM
Hi dahall,

Thanks for your quick response.

So, I have tried with a different account. i.e. I have connected with my credentials and creating the task using a different credential. In that case, I have seen that the ConnectedDomain and ConnectedUser are showing the values for the other credential that I am using. UserName property is also showing up and it is same as ConnectedUser but UserDomain is still NULL. What I need to do to have it populated?

For now I am using ConnectedDomain and ConnectedUser properties but I am looking for a better option since those properties are marked as deprecated.


Feb 18, 2015 at 3:17 PM
When UserDomain is NULL, does ConnectedDomain match the domain specified by System.Environment.UserDomain? I may have a logic error if you are getting UserName but not UserDomain.