Page 1 sur 1
shortname

Publié:
13 Sep 2011 à 08:48
par seroa
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.

Publié:
13 Sep 2011 à 08:50
par Michael DELIQUE
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 ?

Publié:
13 Sep 2011 à 08:57
par seroa
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.

Publié:
13 Sep 2011 à 09:01
par Michael DELIQUE
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

Publié:
13 Sep 2011 à 09:03
par seroa
Merci

Publié:
13 Sep 2011 à 09:32
par Raziel
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.