Deadline.Users.UserInfo returning wrong results

Hey Guys,
For one of our in house onJobCompletion event email we want to get the list of all the users from the “Notification users” settings for the job and then look for each individual users preferences for receiving the emails based on which we email them. But when using Deadlines UserInfo class its not returning the correct values for the user based notifications,

from Deadline.Users import *
usr = UserInfo(my_name)
print usr.EmailNotification
print usr.UserEmailNotification
print  usr.get_UserEmailNotification()

all these things returns “False” even when i have turned on the Job notification emails for my own account in Deadline monitor.

Can some one tell me what im doing wrong here.

~Abhijeet

Hey Abhijeet,

The code you posted is actually creating a brand new user object, using your existing username. This explains why its properties aren’t what you expect them to be, since they are just the default values for new users.

To retrieve existing users, you need to use our RepositoryUtils.GetUserInfo function, which will return a UserInfo with the correct properties:

from Deadline.Scripting import * usr = RepositoryUtils.GetUserInfo( my_name, True ) print usr.EmailNotification print usr.UserEmailNotification

Hope this helps!

Cheers,
Jon

Hey Jon,
yes figured that out this morning.Thanks for all help, really appreciate it.

~Abhijeet