shortname

Forum destiné aux questions sur le développement : Formules, LotusScript, Java ...

shortname

Messagepar seroa » 13 Sep 2011 à 08:48

Bonjour à tous,

Comment retrouver facilement le ShortName d'un utilisateur à partir du nom d'un utilisateur (Nom Simple)?

Je ne trouve pas de vue dans la names.nsf indexée à partir du nom simple. Ou qui contient le champ ShortName et je voudrais éviter d'en créer une nouvelle sur cette base.

J'ai peur de devoir faire une recherche avec le FullName, puis ouvrir chaque document afin d'extraire le champ ShortName.

Vous voyez une autre solution ?

Merci.
Dernière édition par seroa le 13 Sep 2011 à 09:03, édité 1 fois.
seroa
Posteur expérimenté
Posteur expérimenté
 
Message(s) : 304
Inscrit(e) le : 08 Nov 2007 à 08:36
Localisation : Mâcon

Messagepar Michael DELIQUE » 13 Sep 2011 à 08:50

ahhhhh le names est indexé ! vadé retro satanassssss !

tu as besoin d'avoir le shortname de maniere ponctuelle ou tu as des traitement de masse a faire ?
Cordialement

Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN
Avatar de l’utilisateur
Michael DELIQUE
Administrateur
Administrateur
 
Message(s) : 12183
Inscrit(e) le : 16 Déc 2004 à 10:36
Localisation : Paris/Cergy

Messagepar seroa » 13 Sep 2011 à 08:57

En fait j'ai une liste de nom d'utilisateur sous la forme NomSimple (Prénom + Nom) , une dizaine environ. Je doit pour chaque utilisateur récupérer leur ShortName, car c'est leur identifiant sur une base sql.
seroa
Posteur expérimenté
Posteur expérimenté
 
Message(s) : 304
Inscrit(e) le : 08 Nov 2007 à 08:36
Localisation : Mâcon

Messagepar Michael DELIQUE » 13 Sep 2011 à 09:01

ok, bon

regarde ces tips ça devrais t'aider => http://forum.dominoarea.org/nab-f33.html

et voici une fonction à moi pour récupérer les infos utilisateurs, tu trouvera les fonctions manquante dans le lien que je t'ai passé au dessus

Code : Tout sélectionner
Public Function NamesLookUP_Document(wUser As String,wnbEmployeeID As Boolean, wnbSearchGroup As Boolean,wDB As NotesDatabase) As NotesDocument

   Dim Doc As NotesDocument
   Dim DBNAB As notesDatabase
   Dim nmUser As NotesName
   Dim vwNAB As NotesView
   Dim vrValue As Variant
   Dim Collection As NotesDocumentCollection
   Dim NameView As String
   
   On Error Goto CatchError
   
   Set NamesLookUP_Document = Nothing
   
   If Trim(wUser)="" Then
      Exit Function
   End If
   
   If wDB Is Nothing Then
      Set  DBNAB = DBOpenNAB("",True)
      Set wDB = DBNAB
   Else
      Set DBNAB = wDB
   End If
   
   If DBNAB Is Nothing Then
      Error 9999,"DBNAB is Nothing"
      Exit Function
   End If
   
   If wnbEmployeeID = True Then
      Set Collection = DBNAB.Search({Form = "Person" & @uppercase(@trim(EmployeeID)) = "}+Ucase(Trim(wUser))+{"},Nothing,0)
      If Not Collection Is Nothing Then
         If Collection.Count > 0 Then
            Set Doc = Collection.GetFirstDocument
         End If
         Set Collection = Nothing
      End If
   Else      
      If wnbSearchGroup = True Then
         NameView = "($VIMGroups)"
      Else
         NameView = "($VIMPeople)"
      End If
      Set vwNAB = DBNAB.GetView(NameView)
      If  vwNAB Is Nothing Then
         Error 9999,"view vwNAB '"+NameView+"' is Nothing"
         Exit Function
      End If
      
      Set nmUser = New NotesName(Trim(wUser))
      Set Doc = vwNAB.GetDocumentByKey(nmUser.Abbreviated,True)
      
      If Doc Is Nothing Then
         Set Doc = vwNAB.GetDocumentByKey(nmUser.Canonical,True)
      End If
      
      If Not Doc Is Nothing Then
         Set NamesLookUP_Document = Doc
         Set Doc = Nothing
         Set vwNAB = Nothing
         Set DBNAB = Nothing
         Set nmUser = Nothing
         Exit Function
      End If
      
      Set vwNAB = Nothing   
      If wnbSearchGroup = True Then
         NameView = "($Groups)"
      Else
         NameView = "($Users)"
      End If
      Set vwNAB = DBNAB.GetView(NameView)
      If  vwNAB Is Nothing Then
         Error 9999,"view vwNAB '"+NameView+"' is Nothing"
         Exit Function
      End If
      
      Set Doc = vwNAB.GetDocumentByKey(Trim(wUser),True)
      
      If Doc Is Nothing Then
         Set Doc = vwNAB.GetDocumentByKey(Lcase(Trim(wUser)),True)
      End If
      
      If Doc Is Nothing Then
         Set Doc = vwNAB.GetDocumentByKey(Ucase(Trim(wUser)),True)
      End If
      
      If Doc Is Nothing Then
         Set Doc = vwNAB.GetDocumentByKey(nmUser.Abbreviated,True)
      End If
      
      If Doc Is Nothing Then
         Set Doc = vwNAB.GetDocumentByKey(Lcase(nmUser.Abbreviated),True)
      End If
      
      If Doc Is Nothing Then
         Set Doc = vwNAB.GetDocumentByKey(Ucase(nmUser.Abbreviated),True)
      End If
      
      If Doc Is Nothing Then
         Set Doc = vwNAB.GetDocumentByKey(nmUser.Common,True)
      End If
      
      If Doc Is Nothing Then
         Set Doc = vwNAB.GetDocumentByKey(Lcase(nmUser.Common),True)
      End If
      
      If Doc Is Nothing Then
         Set Doc = vwNAB.GetDocumentByKey(Ucase(nmUser.Common),True)
      End If
      
      If Doc Is Nothing Then
         vrValue = Evaluate_Ls({@Ascii("}+Trim(wUser)+{")},Nothing)
         Select Case Trim(vrValue(0))
         Case "", Trim(wUser)
            REM on fait rien, car retour vide ou identique
         Case Else
            Set Doc = vwNAB.GetDocumentByKey(Trim(vrValue(0)),True)
            
            If Doc Is Nothing Then
               Set Doc = vwNAB.GetDocumentByKey(Lcase(Trim(vrValue(0))),True)
            End If
            
            If Doc Is Nothing Then
               Set Doc = vwNAB.GetDocumentByKey(Ucase(Trim(vrValue(0))),True)
            End If
            
            Set nmUser = Nothing         
            Set nmUser = New NotesName(Trim(vrValue(0)))
            
            If Doc Is Nothing Then
               Set Doc = vwNAB.GetDocumentByKey(nmUser.Abbreviated,True)
            End If
            
            If Doc Is Nothing Then
               Set Doc = vwNAB.GetDocumentByKey(Lcase(nmUser.Abbreviated),True)
            End If
            
            If Doc Is Nothing Then
               Set Doc = vwNAB.GetDocumentByKey(Ucase(nmUser.Abbreviated),True)
            End If
            
            If Doc Is Nothing Then
               Set Doc = vwNAB.GetDocumentByKey(nmUser.Common,True)
            End If
            
            If Doc Is Nothing Then
               Set Doc = vwNAB.GetDocumentByKey(Lcase(nmUser.Common),True)
            End If
            
            If Doc Is Nothing Then
               Set Doc = vwNAB.GetDocumentByKey(Ucase(nmUser.Common),True)
            End If
         End Select
      End If
      
      Set vwNAB = Nothing
      Set nmUser = Nothing
   End If
   
   If Not Doc Is Nothing Then
      Set NamesLookUP_Document = Doc
      Set Doc = Nothing
   End If
   
   Set DBNAB = Nothing      
   
   Exit Function
CatchError:
   Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   Set NamesLookUP_Document = Nothing
   Exit Function
End Function
Cordialement

Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN
Avatar de l’utilisateur
Michael DELIQUE
Administrateur
Administrateur
 
Message(s) : 12183
Inscrit(e) le : 16 Déc 2004 à 10:36
Localisation : Paris/Cergy

Messagepar seroa » 13 Sep 2011 à 09:03

Merci
seroa
Posteur expérimenté
Posteur expérimenté
 
Message(s) : 304
Inscrit(e) le : 08 Nov 2007 à 08:36
Localisation : Mâcon

Messagepar Raziel » 13 Sep 2011 à 09:32

Tu peux aussi attaquer la vue ($Users) de ton carnet d'adresses. Cette vue liste les user en fonction de nom complet, du shortname, du nom + prénom, etc...

Donc, à partir du simple du nom de l'utilisateur (Prénom + Nom) tu pourra retrouver le bon document et donc le shortName affecté à cet utilisateur.
Raziel

L'administration est un lieu ou les gens qui arrivent en retard croisent dans l'escalier ceux qui partent en avance. [Georges Courteline]
Avatar de l’utilisateur
Raziel
Modérateur
Modérateur
 
Message(s) : 1795
Inscrit(e) le : 21 Déc 2004 à 11:06
Localisation : Roubaix


Retour vers Développement