vbscript - Use string as Object method -
basically, i'm creating small script update ad attributes (for super user, not admin).
i've got number of attributes, need custom field user can type in ad attribute , searched ldap query , displayed using objuser.
here code:
do while z = true attrchoice = inputbox("please enter custom attribute wish edit", "custom attribute") msgbox "you have selected " & objuser.+attrchoice, vbokonly+vbinformation, objuser.displayname on error resume next if err.number <> 0 msgbox "error!" & vbcrlf & "attribute cannot found, please try again", vbokonly+vbexclamation, "error" else z = false end if on error goto 0 loop
as can see, i've tried doing objuser. attribute part few different ways - i'm not sure how use string that's input user.
in custom field, user put "mail" , code run objuser.mail - make sense?
if need more information, please say.
obviously, i've set objects further in script , there other parts script. working okay, example:
telchoice = msgbox("user's current telephone number " & objuser.telephonenumber & vbcrlf & vbcrlf & _ "do want change user's telephone number?", vbyesno+vbquestion, objuser.displayname) if telchoice = 6 newtel = inputbox("please enter new telephone number", "telephone number", objuser.telephonenumber) if not adorecord.eof on error resume next objuser.put "telephonenumber", newtel objuser.setinfo on error goto 0 end if msgbox "user's new telephone number " & objuser.telephonenumber, vbokonly+vbinformation, objuser.displayname end if
just use get()
function.
strvalue = objuser.get(attrchoice)
i see you're using put()
function later on assign values attributes. it's similar, opposite.
Comments
Post a Comment