I have searched a lot to find the solutions for this:
In a webinterface a user gives a Samaccountname from a user, the accountexpiration date is shown and can be changed.
With a click on the button the new expiration data should be set for that user. Can anyone help me with the on click command?
Dim deUser As DirectoryEntry = New DirectoryEntry(tbPnummerSearch.Text)
deUser.InvokeSet("AccountExpirationDate", New Object() {New DateTime(2099, 12, 29)})
You should just need to call .CommitChanges() after to save any changes to an account.
deUser.InvokeSet(...)
deUser.CommitChanges()
And when supplying the string for the DirectoryEntry "tbPnummerSearch.Text", make sure you are using the full path to the user object. Do a search for the user object and get the result.path
and use it. And when declaring the DirectoryEntry make sure you are supplying credentials that have permissions to modify active directory objects if you are not running the application pool under such creditials or have them in the web.config. IE
NewDirectoryEntry(tbPnummerSearch.Text, Username, UserPassWord).
Marked as answer by Angie xu - MSFT on Nov 12, 2012 11:02 PM
peterV
Member
87 Points
123 Posts
Accout expiration date
Nov 05, 2012 08:45 AM|LINK
Hi All,
I have searched a lot to find the solutions for this:
In a webinterface a user gives a Samaccountname from a user, the accountexpiration date is shown and can be changed.
With a click on the button the new expiration data should be set for that user. Can anyone help me with the on click command?
Dim deUser As DirectoryEntry = New DirectoryEntry(tbPnummerSearch.Text) deUser.InvokeSet("AccountExpirationDate", New Object() {New DateTime(2099, 12, 29)})Doesnt work.....
Thanks,
Peter
gww
Contributor
2143 Points
458 Posts
Re: Accout expiration date
Nov 11, 2012 01:55 PM|LINK
You should just need to call .CommitChanges() after to save any changes to an account.
And when supplying the string for the DirectoryEntry "tbPnummerSearch.Text", make sure you are using the full path to the user object. Do a search for the user object and get the result.path and use it. And when declaring the DirectoryEntry make sure you are supplying credentials that have permissions to modify active directory objects if you are not running the application pool under such creditials or have them in the web.config. IE New DirectoryEntry(tbPnummerSearch.Text, Username, UserPassWord).
peterV
Member
87 Points
123 Posts
Re: Accout expiration date
Nov 14, 2012 05:29 AM|LINK
Hi GWW, Thank you, I will try it and let you know the result.
Thanks again,
Pete