begin process at 2012 02 11 22:09:42
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Réseau & Internet

 > MINI CLIENT NOTES ECRIT EN VB5 !

MINI CLIENT NOTES ECRIT EN VB5 !


 Description

Cliquez pour voir la capture en taille normale
Démonstration de l'utilisation des object COM de Lotus Notes. (Version 5 minimum) pour faire un petit "client" Notes en VB5 (lecture et affichage des message reçu)

Merci à Oguruma, modérateur de www.dominoarea.org (Forum Lotus Notes en Français)

Source

  • VERSION 5.00
  • Begin VB.Form Form1
  • Caption = "Form1"
  • ClientHeight = 5580
  • ClientLeft = 60
  • ClientTop = 450
  • ClientWidth = 6885
  • LinkTopic = "Form1"
  • ScaleHeight = 5580
  • ScaleWidth = 6885
  • StartUpPosition = 3 'Windows Default
  • Begin VB.CommandButton CmdMove
  • Caption = "Move To"
  • Enabled = 0 'False
  • Height = 375
  • Left = 5880
  • TabIndex = 10
  • Top = 120
  • Width = 855
  • End
  • Begin VB.TextBox Folder
  • Height = 375
  • Left = 3240
  • TabIndex = 9
  • Top = 120
  • Width = 2655
  • End
  • Begin VB.CommandButton CmdLast
  • Caption = ">> |"
  • Enabled = 0 'False
  • BeginProperty Font
  • Name = "MS Sans Serif"
  • Size = 8.25
  • Charset = 0
  • Weight = 700
  • Underline = 0 'False
  • Italic = 0 'False
  • Strikethrough = 0 'False
  • EndProperty
  • Height = 375
  • Left = 2280
  • TabIndex = 8
  • Top = 120
  • Width = 615
  • End
  • Begin VB.CommandButton CmdNext
  • Caption = ">"
  • Enabled = 0 'False
  • BeginProperty Font
  • Name = "MS Sans Serif"
  • Size = 8.25
  • Charset = 0
  • Weight = 700
  • Underline = 0 'False
  • Italic = 0 'False
  • Strikethrough = 0 'False
  • EndProperty
  • Height = 375
  • Left = 1560
  • TabIndex = 7
  • Top = 120
  • Width = 615
  • End
  • Begin VB.CommandButton CmdPrevious
  • Caption = "<"
  • Enabled = 0 'False
  • BeginProperty Font
  • Name = "MS Sans Serif"
  • Size = 8.25
  • Charset = 0
  • Weight = 700
  • Underline = 0 'False
  • Italic = 0 'False
  • Strikethrough = 0 'False
  • EndProperty
  • Height = 375
  • Left = 840
  • TabIndex = 6
  • Top = 120
  • Width = 615
  • End
  • Begin VB.TextBox From
  • Height = 375
  • Left = 1200
  • Locked = -1 'True
  • TabIndex = 3
  • Top = 1080
  • Width = 5535
  • End
  • Begin VB.CommandButton cmdFirst
  • Caption = "| <<"
  • Enabled = 0 'False
  • BeginProperty Font
  • Name = "MS Sans Serif"
  • Size = 8.25
  • Charset = 0
  • Weight = 700
  • Underline = 0 'False
  • Italic = 0 'False
  • Strikethrough = 0 'False
  • EndProperty
  • Height = 375
  • Left = 120
  • TabIndex = 2
  • Top = 120
  • Width = 615
  • End
  • Begin VB.TextBox Body
  • Height = 3855
  • Left = 120
  • Locked = -1 'True
  • MultiLine = -1 'True
  • ScrollBars = 3 'Both
  • TabIndex = 1
  • Top = 1560
  • Width = 6615
  • End
  • Begin VB.TextBox subject
  • Height = 375
  • Left = 1200
  • Locked = -1 'True
  • TabIndex = 0
  • Top = 720
  • Width = 5535
  • End
  • Begin VB.Label Label
  • Alignment = 1 'Right Justify
  • BackStyle = 0 'Transparent
  • Caption = "De :"
  • BeginProperty Font
  • Name = "MS Sans Serif"
  • Size = 12
  • Charset = 0
  • Weight = 700
  • Underline = 0 'False
  • Italic = 0 'False
  • Strikethrough = 0 'False
  • EndProperty
  • Height = 255
  • Index = 1
  • Left = 240
  • TabIndex = 5
  • Top = 1080
  • Width = 855
  • End
  • Begin VB.Label Label
  • Alignment = 1 'Right Justify
  • BackStyle = 0 'Transparent
  • Caption = "Sujet :"
  • BeginProperty Font
  • Name = "MS Sans Serif"
  • Size = 12
  • Charset = 0
  • Weight = 700
  • Underline = 0 'False
  • Italic = 0 'False
  • Strikethrough = 0 'False
  • EndProperty
  • Height = 255
  • Index = 0
  • Left = 240
  • TabIndex = 4
  • Top = 720
  • Width = 855
  • End
  • End
  • Attribute VB_Name = "Form1"
  • Attribute VB_GlobalNameSpace = False
  • Attribute VB_Creatable = False
  • Attribute VB_PredeclaredId = True
  • Attribute VB_Exposed = False
  • Option Explicit
  • '-----------------------------------------------------------------------------
  • ' (C)2005 by Patrick MOIRE
  • '------------------------------------------------------------------------------
  • ' DEMO UTILISATION DES OBJETS COM de Lotus Notes
  • '
  • ' Merci à Oguruma, modérateur de www.dominoarea.org (Forum Lotus Notes en Français)
  • Private session As New NotesSession
  • Private dir As NotesDbDirectory
  • Private db As NotesDatabase
  • Private View As NotesView
  • Private doc As NotesDocument
  • '------------------------------------------------------------------------------------
  • ' Connection a Lotus Notes
  • '------------------------------------------------------------------------------------
  • Private Sub Form_Paint()
  • Me.AutoRedraw = True
  • DoEvents
  • Me.Caption = "Connexion en cours..."
  • session.Initialize
  • ' PS : en cas de problème, remplacer par :
  • '
  • ' session.Initialize "password"
  • '
  • ' voir :
  • '
  • ' session.InitializeUsingNotesUserName "User", "password"
  • '
  • Set dir = session.GetDbDirectory("")
  • Set db = dir.OpenMailDatabase
  • Me.Caption = db.filename
  • Set View = db.GetView("($inbox)")
  • Me.Caption = db.filename & " : " & View.Name
  • Call cmdFirst_Click
  • End Sub
  • '------------------------------------------------------------------------------------
  • ' Déplacement dans la liste des couriers
  • '------------------------------------------------------------------------------------
  • Private Sub cmdFirst_Click()
  • Set doc = View.GetFirstDocument
  • Me.CmdNext.Enabled = (Not doc Is Nothing)
  • Me.CmdPrevious.Enabled = False
  • Call Affiche
  • End Sub
  • Private Sub CmdPrevious_Click()
  • If Not doc Is Nothing Then
  • Set doc = View.GetPrevDocument(doc)
  • Me.CmdNext.Enabled = True
  • Me.CmdPrevious.Enabled = Not (View.GetPrevDocument(doc) Is Nothing)
  • End If
  • Call Affiche
  • End Sub
  • Private Sub CmdNext_Click()
  • If Not doc Is Nothing Then
  • Set doc = View.GetNextDocument(doc)
  • Me.CmdPrevious.Enabled = True
  • Me.CmdNext.Enabled = Not (View.GetNextDocument(doc) Is Nothing)
  • End If
  • Call Affiche
  • End Sub
  • Private Sub CmdLast_Click()
  • Set doc = View.GetLastDocument
  • Me.CmdNext.Enabled = False
  • Call Affiche
  • End Sub
  • '------------------------------------------------------------------------------------
  • ' Affichage d'un courier
  • '------------------------------------------------------------------------------------
  • Private Sub Affiche()
  • Me.CmdMove.Enabled = (Not doc Is Nothing)
  • Me.cmdFirst.Enabled = Me.CmdPrevious.Enabled
  • Me.CmdLast.Enabled = Me.CmdNext.Enabled
  • Me.subject.Text = ""
  • Me.From.Text = ""
  • Me.Body.Text = ""
  • If Not doc Is Nothing Then
  • If doc.HasItem("subject") Then Me.subject.Text = doc.GetItemValue("subject")(0)
  • If doc.HasItem("from") Then Me.From.Text = doc.GetItemValue("from")(0)
  • If doc.HasItem("body") Then Me.Body.Text = doc.GetItemValue("body")(0)
  • End If
  • End Sub
  • '------------------------------------------------------------------------------------
  • ' Deplacement d'un document dans un "folder"
  • '------------------------------------------------------------------------------------
  • Private Sub CmdMove_Click()
  • moveToFolder db, doc, Me.Folder.Text
  • End Sub
  • Function moveToFolder(dbMailbox As NotesDatabase, docMailbox As NotesDocument, folderName As String) As Boolean
  • Dim docMailBoxCopy As NotesDocument
  • On Error GoTo handleError
  • Set docMailBoxCopy = docMailbox.CopyToDatabase(dbMailbox)
  • docMailBoxCopy.PutInFolder folderName, True
  • docMailbox.Remove True
  • On Error GoTo 0
  • moveToFolder = True
  • Exit Function
  • handleError:
  • MsgBox "Error # " & Err & " : " & Error$ & " - line " & Erl, 16, "DEMOA Notes Error - moveToFolder"
  • End Function
  • '------------------------------------------------------------------------------------
  • ' Déconnection de Lotus Notes
  • '------------------------------------------------------------------------------------
  • Private Sub Form_Unload(Cancel As Integer)
  • Set doc = Nothing
  • Set View = Nothing
  • Set db = Nothing
  • Set dir = Nothing
  • Set session = Nothing
  • End Sub
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5580
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6885
   LinkTopic       =   "Form1"
   ScaleHeight     =   5580
   ScaleWidth      =   6885
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton CmdMove 
      Caption         =   "Move To"
      Enabled         =   0   'False
      Height          =   375
      Left            =   5880
      TabIndex        =   10
      Top             =   120
      Width           =   855
   End
   Begin VB.TextBox Folder 
      Height          =   375
      Left            =   3240
      TabIndex        =   9
      Top             =   120
      Width           =   2655
   End
   Begin VB.CommandButton CmdLast 
      Caption         =   ">> |"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2280
      TabIndex        =   8
      Top             =   120
      Width           =   615
   End
   Begin VB.CommandButton CmdNext 
      Caption         =   ">"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1560
      TabIndex        =   7
      Top             =   120
      Width           =   615
   End
   Begin VB.CommandButton CmdPrevious 
      Caption         =   "<"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   840
      TabIndex        =   6
      Top             =   120
      Width           =   615
   End
   Begin VB.TextBox From 
      Height          =   375
      Left            =   1200
      Locked          =   -1  'True
      TabIndex        =   3
      Top             =   1080
      Width           =   5535
   End
   Begin VB.CommandButton cmdFirst 
      Caption         =   "| <<"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   615
   End
   Begin VB.TextBox Body 
      Height          =   3855
      Left            =   120
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   1
      Top             =   1560
      Width           =   6615
   End
   Begin VB.TextBox subject 
      Height          =   375
      Left            =   1200
      Locked          =   -1  'True
      TabIndex        =   0
      Top             =   720
      Width           =   5535
   End
   Begin VB.Label Label 
      Alignment       =   1  'Right Justify
      BackStyle       =   0  'Transparent
      Caption         =   "De :"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   1
      Left            =   240
      TabIndex        =   5
      Top             =   1080
      Width           =   855
   End
   Begin VB.Label Label 
      Alignment       =   1  'Right Justify
      BackStyle       =   0  'Transparent
      Caption         =   "Sujet :"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   240
      TabIndex        =   4
      Top             =   720
      Width           =   855
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

'-----------------------------------------------------------------------------
' (C)2005 by Patrick MOIRE
'------------------------------------------------------------------------------
' DEMO UTILISATION DES OBJETS COM de Lotus Notes
'
' Merci à Oguruma, modérateur de www.dominoarea.org (Forum Lotus Notes en Français)


  Private session As New NotesSession
  Private dir As NotesDbDirectory
  Private db As NotesDatabase
  Private View As NotesView
  Private doc As NotesDocument


'------------------------------------------------------------------------------------
' Connection a Lotus Notes
'------------------------------------------------------------------------------------

Private Sub Form_Paint()

  Me.AutoRedraw = True
  DoEvents
  
  Me.Caption = "Connexion en cours..."
  
  session.Initialize
 ' PS : en cas de problème, remplacer par :
 '
 ' session.Initialize "password"
 '
 ' voir :
 '
 ' session.InitializeUsingNotesUserName "User", "password"
 '
   
  Set dir = session.GetDbDirectory("")
  Set db = dir.OpenMailDatabase
  
  Me.Caption = db.filename
  
  Set View = db.GetView("($inbox)")
  Me.Caption = db.filename & " : " & View.Name
  
  Call cmdFirst_Click

End Sub
  
  
'------------------------------------------------------------------------------------
' Déplacement dans la liste des couriers
'------------------------------------------------------------------------------------

Private Sub cmdFirst_Click()
  Set doc = View.GetFirstDocument
  Me.CmdNext.Enabled = (Not doc Is Nothing)
  Me.CmdPrevious.Enabled = False
  Call Affiche
End Sub

Private Sub CmdPrevious_Click()
  If Not doc Is Nothing Then
    Set doc = View.GetPrevDocument(doc)
    Me.CmdNext.Enabled = True
    Me.CmdPrevious.Enabled = Not (View.GetPrevDocument(doc) Is Nothing)
  End If
  Call Affiche
End Sub

Private Sub CmdNext_Click()
  If Not doc Is Nothing Then
    Set doc = View.GetNextDocument(doc)
    Me.CmdPrevious.Enabled = True
    Me.CmdNext.Enabled = Not (View.GetNextDocument(doc) Is Nothing)
  End If
  Call Affiche
End Sub

Private Sub CmdLast_Click()
  Set doc = View.GetLastDocument
  Me.CmdNext.Enabled = False
  Call Affiche
End Sub

  
'------------------------------------------------------------------------------------
' Affichage d'un courier
'------------------------------------------------------------------------------------

Private Sub Affiche()

  Me.CmdMove.Enabled = (Not doc Is Nothing)
  Me.cmdFirst.Enabled = Me.CmdPrevious.Enabled
  Me.CmdLast.Enabled = Me.CmdNext.Enabled
  
  Me.subject.Text = ""
  Me.From.Text = ""
  Me.Body.Text = ""

  If Not doc Is Nothing Then
    If doc.HasItem("subject") Then Me.subject.Text = doc.GetItemValue("subject")(0)
    If doc.HasItem("from") Then Me.From.Text = doc.GetItemValue("from")(0)
    If doc.HasItem("body") Then Me.Body.Text = doc.GetItemValue("body")(0)
  End If
  
End Sub


'------------------------------------------------------------------------------------
' Deplacement d'un document dans un "folder"
'------------------------------------------------------------------------------------

Private Sub CmdMove_Click()
  moveToFolder db, doc, Me.Folder.Text
End Sub

Function moveToFolder(dbMailbox As NotesDatabase, docMailbox As NotesDocument, folderName As String) As Boolean
  Dim docMailBoxCopy As NotesDocument
    On Error GoTo handleError
      Set docMailBoxCopy = docMailbox.CopyToDatabase(dbMailbox)
      docMailBoxCopy.PutInFolder folderName, True
      docMailbox.Remove True
    On Error GoTo 0
    moveToFolder = True
    Exit Function
handleError:
  MsgBox "Error # " & Err & " : " & Error$ & " - line " & Erl, 16, "DEMOA Notes Error - moveToFolder"
End Function


'------------------------------------------------------------------------------------
' Déconnection de Lotus Notes
'------------------------------------------------------------------------------------

Private Sub Form_Unload(Cancel As Integer)
  Set doc = Nothing
  Set View = Nothing
  Set db = Nothing
  Set dir = Nothing
  Set session = Nothing
End Sub

 Conclusion

Allez... j'en profite pour mettre un code pour envoyer un email via Notes. Pas de moi, mais fait un bon complément à mon code !

Private Sub Send()

    Dim session As Object
    Dim db As Object
    Dim doc As Object

    Set session = CreateObject("Notes.NotesSession")
    Set db = session.GetDatabase("", "")
    Call db.OPENMAIL

    Set doc = db.CreateDocument()
    With doc
        .Form = "Memo"
        .SendTo = "adresse@serveur.com"
        .CopyTo = "adresse@serveur.com"
        .subject = "Petit test"
        .Body = "Ceci est un petit test d'envoie de message"
        .From = session.CommonUserName
        .PostedDate = Now
        .SaveMessageOnSend = True
    End With
    Call doc.Send(True)

    Set session = Nothing
    Set db = Nothing
    Set doc = Nothing

End Sub


 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

Source avec une capture AJOUT D'UN CONTRÔLE CALENDRIER EN DYNAMIQUE SUR UNE FORM, D'...
Source avec Zip Source avec une capture WEBNTCVS : CONSULTATION D'UN RÉFÉRENCIEL NT-CVS DEPUIS UN N...
Source avec Zip Source avec une capture CHECKBOX DANS UNE DBGRID
GESTION DES ERRORLEVEL EN VB
Source avec Zip TRAITEMENT SUR IMAGE : ROTATION 90°, EFFETS 3D, CONVERSION E...

 Sources de la même categorie

Source avec Zip Source avec une capture GESTIONNAIRE DE TÉLÉCHARGEMENT, AVEC REPRISE ET MULTITHREADI... par Madx23
Source avec Zip Source avec une capture CONVERTIR DU TEXTE RTF EN CODE HTML ET VICE-VERSA par vicosta
Source avec Zip Source avec une capture DICTIONAIRE TEXT/AUDIO/VISUELLE ANGLAIS AVEC WEBBROWSER CONT... par majnounmajda
Source avec Zip Source .NET (Dotnet) NSLOOKUP EN VB.NET OU COMMENT FAIRE UNE REQÛETE DNS EN PRÉCI... par ShareVB
Source avec Zip Source avec une capture MINI SEVEUR HTTP AVEC INTERFACE GRAPHIQUE ET IMPLÉMENTATIONS... par lemout

Commentaires et avis

Commentaire de Neo.balastik le 27/04/2005 17:29:04

J'essaye demain à mon boulot.

Commentaire de Derrick soft le 20/06/2005 19:29:34

Bonjour,

Je ne pensais pas notre Oguruma si célèbre.

Cordialement

Stéphane Maillard
Saint Malo - Creil - Paris
----------------------------------------------------------------------------------------
http://www.dominoarea.org
----------------------------------------------------------------------------------------
Administrateur (Débutant) & Développeur Lotus Notes (A vous de juger)

Commentaire de EvilGost le 17/03/2006 12:06:06

ton code oblige a avoir notes d'ouvert...il y a un moyen d'envoyer un mail avec notes fermé en injectant le mot de passe a l'initialize

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,780 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales