I am writing a scheduled job to update user data from an Active Directory. I am pulling the member list from Membership.GetAllUsers(), and successfully loading the profile data from AD. What I don't know how to do is saving this data back to EPiServer. When the code was only updating the current user, it used EPiServer.Community.CommunitySystem.CurrentContext.DefaultSecurity.CurrentUser .Clone() for writing the data and EPiServer.Community.CommunitySystem.CurrentContext.DefaultSecurity.UpdateUser(displayUserClone); for persisting the data. However, AFAIK CurrentContext is not available in a scheduled job - I tried Settings.DefaultSecurity.GetUserByUserName(user.UserName) and UserQuery, but I am unable to find the user. How can I update the user from a scheduled job?
Hi,
I am writing a scheduled job to update user data from an Active Directory. I am pulling the member list from Membership.GetAllUsers(), and successfully loading the profile data from AD. What I don't know how to do is saving this data back to EPiServer. When the code was only updating the current user, it used EPiServer.Community.CommunitySystem.CurrentContext.DefaultSecurity.CurrentUser .Clone() for writing the data and EPiServer.Community.CommunitySystem.CurrentContext.DefaultSecurity.UpdateUser(displayUserClone); for persisting the data. However, AFAIK CurrentContext is not available in a scheduled job - I tried Settings.DefaultSecurity.GetUserByUserName(user.UserName) and UserQuery, but I am unable to find the user. How can I update the user from a scheduled job?