Is it possible to create a periodic (scheduled job) report of all EpiServer users that can be sent to someone? Preferabbly in .csv format?
I would really appreciate any pointing in the right direction or any code examples that I can look into.
How would you recommend to best go about this?
Are you talking about backend users or users of the front end of your website? What authentication system do you have in place? E.g. the OOTB asp.net identity, azure ad/OAuth provider?
Sorry I meant backend users. I think it is the OOTB authentication.
Get an instance of the user store
var userStore = new UserStore<ApplicationUser>(new IdentityDbContext(connectionString));
Substituing whatever user you're using if you're using any other role than the standard ApplicationUser else just user that then you can access all users via
If you are using AspNetIdentity, you can use UserManager<TUser>.Users (or ApplicationUserManager<TUser>), which TUser is your implementation of ApplicationUser
Thank you for the suggestions so far. How hard would it be to periodically generate a report in .csv format and have it sent to a location? Or what other suggestions would you have to implement something similar?
It is just another scheduled job, so the "periodically" task is handled for you, other than that it is normal .net code Scheduled jobs | Optimizely Developer Community
Thank you all for the info so far. Some more questions, any recommendations on the best tools for creating a .csv file? Also would you recommend to use the built in CMS E-Mailing capabilities to send this report to someone, or is better/safer to have the file sent/stored at a specific location?
I think you are over thinking it. Check your requirements to make sure you fulfill it, then do a minimal approach. You can always improve later
A search for "C# convert List<T> to csv" would be enough for first question.
Cms has no builtin mail capacity but you can simply write one using .net. Depends on what you need, but you might store the csv as an asset with specific access rights granted to certain people, and send the url to those.