This project has moved and is read-only. For the latest updates, please go here.

UserAccountDomain and UserName NULL when ConnectedDomain and ConnectedUser have values

Topics: Errors
Feb 17, 2015 at 5:30 PM
Hi,

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 2.3.0.22156 where the run time version in v4.0.30319.

Thanks,

UBK
Feb 17, 2015 at 7: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 12:50 PM
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.

Thanks,

UBK
Feb 18, 2015 at 4: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.