--- Erhalten von  I0.U100843 0512 20 4180                    15.11.02 09.16

--- Erhalten von  I0.U100843 0512 20 4180                    15.11.02 09.01


Guten Tag folgender Script hat die Aufgabe bei einem bestehenden Eintrag im
einen X.500 Verzeichnis das Attribut dxmAdsYesNo zu mutieren.

Falls das Attribut bereits besteht gelingt mir dies problemlos. Anders
sieht es aus, wenn das Attribut noch nicht besteht. Das At geh�rt zu
ObjectClass dxmADSUser d.h. dass wohl eine Manipulation mit dieser
Objectclass passieren muss. Ich habe dieses probiert und auch die Beispiele
die man o auf dem WEB findet, allerdings mache ich wohl einen
Ueberlegungsfehler.

Folgender Codeteil funktioniert nicht   If (isNull(strOldValue) Or
isEmpty(strOldValue)) der else Teil dagegen funktioniert wie gew�nscht.


  strOldValue = objUser.dxmADsYesNo
  'strNewValue = "True"
  strNewValue = "False"
 '**********************************************************************
 ' put or create the new value for the flag " ==> Default is True
 '**********************************************************************
  If (isNull(strOldValue) Or isEmpty(strOldValue)) Then
    objUser.Put "objectClass","dxmADsUser"
    objUser.Put "dxmADsYesNo",strNewValue
  else
    objUser.Put "dxmADsYesNo",strNewValue
  End If


F�r Eure Vorschl�ge bin ich sehr dankbar. Nach der Absenderinfo ist  der
komplette
Source einsehbar.

---------------------------------------------------------------------------
Absenderinfo/Kontaktadresse:


Peter Kocher
SBB Informatik
Bollwerk 10
CH 3030 Bern

Tel 051 / 220 41 80
[EMAIL PROTECTED]


<HTML>
<BODY>
<%

 '**********************************************************************
 ' Declare all variables
 '**********************************************************************

  DIM objDS        ' Pointer to the root Domain
  DIM objUser      ' Pointer to the User
  DIM objdxmADsUser' Pointer to dxmADsUser
  DIM strPathTemp  ' Used to concat all path parameters
  DIM strPath      ' Pointer to the distinguished name where the system
have to access
  DIM strAccount   ' Pointer to the (Admin) account which will be use for
the access
  DIM strPassword  ' Password which will be used for the access
  DIM strOldValue  ' OldValue from the Attribute we've got
  DIM strNewValue  ' NewValue for  the Attribute we'll change
  DIM strLDAP      ' Constant Value for the root Domain
  DIM strHost      ' Pointer the the URL and Port
                   ' Syntax //URL:Port/
  DIM strOU        ' Pointer to the ou where the user is stored in
  DIM strSearch    ' Pointer to the user we are looking for

 '**********************************************************************
 ' Initialize some variables
 '**********************************************************************
  strLDAP = "LDAP:"
  strHost = "localhost:389"      ' for testing
   '**********************************************************************
   ' Code to replace
   '**********************************************************************

  strSearch = "U100843"
  strCheckUser = UCase(Mid(strSearch,2,1))

  If strCheckUser = "E" Then
     Response.Write "Externer User" & "<BR>"
     strOU = "ou=ext Mitarbeiter"
  else
     Response.Write "Interner User" & "<BR>"
     strOU = "ou=int Mitarbeiter"

  End If

  Response.Write "strCheckUser= " & strCheckUser & "<BR>"

 '**********************************************************************
 ' Get the pointer to the root domain
 '**********************************************************************

  set objDS=GetObject("LDAP:")

 '**********************************************************************
 ' set path, account and password
 '**********************************************************************
  strPathTemp = strLDAP & "//" & strHost & "/" & "cn=" & strSearch &"," &
strOU & ","  & "dc=sbb,dc=ch"
  strPath= strPathTemp
  'strPath="LDAP://localhost:389/cn=U147844,ou=int
Mitarbeiter,dc=sbb,dc=ch"
  strAccount="cn=admin,dc=sbb,dc=ch"
  strPassword="dirxsbb"
  Response.Write "strPathTemp= " & strPathTemp & "<BR>"
  Response.Write "strPath  = " & strPath & "<BR>"

 '**********************************************************************
 ' Get the pointer to the root domain
 '==Login with simple authentification ==> Code 0 (code 1 doesn't work)
 '**********************************************************************

 set objUser = objDS.OpenDsObject(strPath,strAccount,strPassword,0)

 if err.number = 0 then
   Response.Write "Logon OK.<BR>"
 else
   Response.Write "Logon get wrong.<BR>"
 end if

 '**********************************************************************
 ' show the record's content (just useful but not necessary)
 '**********************************************************************
  Response.Write "Name obj = " & objUser.name & "<br>"
  Response.Write "ADS-User = " & objUser.dxmADsYesNo & "<br>"
  Response.Write "GivenName = " & objUser.givenName & "<br>"
  Response.Write "Surname = " & objUser.sn & "<br>"
  Response.Write "Userid = " & objUser.uid & "<br>"
  Response.Write "Memoid = " & objUser.SBBMemoID & "<br>"
  Response.Write "DisplayName = " & objUser.DisplayName & "<br>"
  Response.Write "OE = " & objUser.SBBOrgEinh & "<br>"

 '**********************************************************************
 ' write the old value to the cache
 '**********************************************************************

  strOldValue = objUser.dxmADsYesNo
  'strNewValue = "True"
  strNewValue = "False"
  Response.Write "strOldValue  = " & strOldValue & "<br>"
 '**********************************************************************
 ' put or create the new value for the flag " ==> Default is True
 '**********************************************************************
  If (isNull(strOldValue) Or isEmpty(strOldValue)) Then
    Response.Write "strOldValue is Null or Empty "  & strOldValue &"<br>"
    objUser.Put "objectClass","dxmADsUser"
    objUser.Put "dxmADsYesNo",strNewValue
  else
    Response.Write "strOldValue isn't Null"  & strOldValue &"<br>"
    objUser.Put "dxmADsYesNo",strNewValue
    If Err.Number <> 0 Then
      Response.Write strFontStyle & Err.Number & Err.Description
    else
     Response.Write "strNewValue Update ok  = " & strNewValue & "<br>"
    End If
  End If
 '**********************************************************************
 ' write back the new value
 '**********************************************************************
  objUser.SetInfo
  Response.Write "strNewValue After Update  = " & strNewValue & "<br>"
'**********************************************************************
' clear all objects
'**********************************************************************
 set objUser = Nothing
 set objDS = Nothing
'**********************************************************************
' End of script
'**********************************************************************
%>
</BODY>
</HTML>

---- 15.11.02 09.16 ---- Gesendet an   ------------------------------------
  -> [EMAIL PROTECTED]

| [aspdedatabase] als [email protected] subscribed
| http://www.aspgerman.com/archiv/aspdedatabase/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdedatabase.asp

Antwort per Email an