locked
Accout expiration date RRS feed

  • Question

  • User-139952397 posted

    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

    Monday, November 5, 2012 4:45 AM

Answers

  • User636753033 posted

    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 New DirectoryEntry(tbPnummerSearch.Text, Username, UserPassWord).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 11, 2012 9:55 AM

All replies

  • User636753033 posted

    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 New DirectoryEntry(tbPnummerSearch.Text, Username, UserPassWord).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 11, 2012 9:55 AM
  • User-139952397 posted

    Hi GWW, Thank you, I will try it and let you know the result.

    Thanks again,

     

    Pete

    Wednesday, November 14, 2012 1:29 AM