Verifier l'attachement d'un fichier sur un champ

Verifier l'attachement d'un fichier sur un champ

Messagepar Michael DELIQUE » 16 Oct 2009 à 15:37

RagDam a écrit:pour vérifier l'existence d'un attachement dans un champ Rich Text spécifique et AVANT enregistrement du document, il faut utiliser la méthode Refresh avec le paramètre True.



Code : Tout sélectionner
   Dim UIWork As New NotesUIWorkspace
   Dim uidoc  As NotesUIDocument
   Dim HasAttach As Boolean
   Dim doc As NotesDocument
   Dim ritem As NotesRichTextItem
   
   Set uidoc= UIwork.CurrentDocument
' Actualiser les bodys
   uidoc.refresh(True)
   
   HasAttach = False
   
' Instancier le doc
   Set Doc = uidoc.Document
   Set rItem = Doc.GetfirstItem("MonChampRichText")
   If Not rItem Is Nothing Then
      HasAttach = Isarray(rItem.EmbeddedObjects)
   End If
   
   If HasAttach = False Then
      Msgbox "Champ n'a pas de fichier"
   Else
      Msgbox "Fichier présent"
   End If
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 Jérome Deniau » 18 Oct 2009 à 01:39

Et pour le premier avril, tu ajoutes le champ SaveOptions="1" et ton refresh enregistre le document sur disque (ouarf!)
Jérome Deniau
 

Messagepar StasS » 26 Nov 2010 à 15:44

Un grand merci pour le tips ! Ca fait depuis ce midi que je me tape la tête sur l'écran pour trouver une solution ;)
Qui verra vivra !
Avatar de l’utilisateur
StasS
Administrateur
Administrateur
 
Message(s) : 115
Inscrit(e) le : 13 Août 2008 à 07:35
Localisation : Paris

Messagepar mike76 » 26 Nov 2010 à 15:50

Trop bizarre StasS j'étais dans le même cas que toi et grâce à ta réponse ça m'a remonté le post de Michaël
mike76
V.I.P.
V.I.P.
 
Message(s) : 2122
Inscrit(e) le : 12 Oct 2006 à 13:14
Localisation : ROUEN

Messagepar StasS » 29 Nov 2010 à 07:59

Hé hé :wink:
Et beh ça fait 2 heureux le même jour !
Qui verra vivra !
Avatar de l’utilisateur
StasS
Administrateur
Administrateur
 
Message(s) : 115
Inscrit(e) le : 13 Août 2008 à 07:35
Localisation : Paris

Messagepar billbock » 29 Nov 2010 à 12:19

ca marche aussi avec ceci
[syntax="LotusScript"]
Function IsRTFNull(rtfield As String) As Integer
On Error Goto Errhandle
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
'Store the name of the field that currently has focus. Note: if this function is being called from a form button,
'currentfield will be null (because the button has the focus, and not a field). If this function is called
'from an action button, and if the cursor is in a field, then currentfield will correctly store the name
'of the field that has focus. currentfield = uidoc.CurrentField
Call uidoc.GotoField(rtfield)
Call uidoc.SelectAll
'The next line will generate a 4407 error message if the Rich Text Field is null
Call uidoc.DeselectAll
'Return the cursor the the field that had focus before this function ran. If the currentfield variable is null (because a button
'or hotspot had focus, then the cursor will actually wind up getting left in the rich text field.
If currentfield <> "" Then
Call uidoc.GotoField(currentfield)
End If
IsRTFNull = False
Exit Function
Errhandle:
Select Case Err
Case 4407
'the DeselectAll line generated an error message, indicating that the rich text field does not contain anything
If currentfield <> "" Then
Call uidoc.GotoField(currentfield)
End If
IsRTFNull = True
Exit Function
Case Else
'For any other error, force the same error to cause LotusScript to do the error handling
Error Err
End Select
End Function[/syntax]
Avatar de l’utilisateur
billbock
Modérateur
Modérateur
 
Message(s) : 310
Inscrit(e) le : 15 Fév 2007 à 13:58
Localisation : paris


Retour vers Gestion de fichiers