[V4.6] Envoi d'une invitation

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

[V4.6] Envoi d'une invitation

Messagepar CyBeRoN » 17 Août 2007 à 14:05

Bonjour à tous.
Je suis encore avec ma v4.6 et je suis confronté dans un développement à envoyer un mail d'invitation à une réunion.

Quelqu'un a-t-il déjà réalisé ce développement ?

J'ai réussi à créer le document d'invitation mais un problème survient lors de la confirmation du meeting.

Quelqu'un pourrait-il m'aider ?
Merci !
CyBeRoN
Posteur néophyte
Posteur néophyte
 
Message(s) : 93
Inscrit(e) le : 24 Mai 2005 à 11:50

Messagepar Stephane Maillard » 17 Août 2007 à 14:13

Salut,

4.6 que de bons souvenirs, tu as un message d'erreur par hasard ?
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Messagepar CyBeRoN » 17 Août 2007 à 14:33

Quand je clique sur le bouton 'Send Confirmation', il me l'envoie une première fois avec un message 'A notice has been sent to the invitees' et ensuite il me dit 'Do you want to send this to the people/resources you invited ?'. Je réponds par l'affirmative et là il me sort : 'No names found to send mail to' et me laisse sur mon document d'invitation.
Dans la mailbox de la personne invitée, je vois bien la confirmation du meeting. Je lis le mail et hop : 'The appointment document has been deleted from your calendar, do you want to recreate it ?'.
Je dis oui et j'ai une double entrée dans le calendrier pour ce meeting...

Merci d'avance.
CyBeRoN
Posteur néophyte
Posteur néophyte
 
Message(s) : 93
Inscrit(e) le : 24 Mai 2005 à 11:50

Messagepar Stephane Maillard » 17 Août 2007 à 14:39

Salut,

On dirais que ton champs SendTo n'est pas bien renseigné. Qu'est ce que tu as dans ce champs en formule et en valeur ?
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Messagepar Stephane Maillard » 17 Août 2007 à 14:43

Re,

Il ne parle pas de la 4.6 mais voici ce que l'on trouve sur IBM => http://www-111.ibm.com/search/SupportSe ... 0&sortBy=1
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Messagepar CyBeRoN » 20 Août 2007 à 07:56

Voici le code utilisé pour l'instant :

Code : Tout sélectionner
Sub Click(Source As Button)
     On Error Goto ErrorRoutine
     
     Dim s As New NotesSession
     Dim ws As New NotesUIWorkspace
     
     Dim uidoc As NotesUIDocument     
     Dim mdoc As NotesUIDocument 
     Dim db As New NotesDatabase("","")
     Dim doc As NotesDocument, cdoc As NotesDocument, notice As NotesDocument
     
     Dim User As String, Subject As String
     
     Set uidoc = ws.CurrentDocument
     
     If uidoc.isnewdoc Then Call uidoc.save         
     
     Set doc = uidoc.Document
     
     If doc.MeetDate(0) = "" Then
          Messagebox "You must fill in a meeting date before you mail it.", 64, "Incomplete Information"
          Call uidoc.gotofield("MeetDate")
          Exit Sub
     End If
     
     If doc.MeetTime(0) = "" Then
          Messagebox "You must fill in a meeting time before you mail it.", 64, "Incomplete Information"
          Call uidoc.gotofield("MeetTime")
          Exit Sub
     End If
     
     If doc.SendTo(0) = "" Then
          Messagebox "You must fill in the Invitees for this meeting before you mail it.", 64, "Incomplete Information"
          Call uidoc.gotofield("SendTo")
          Exit Sub
     End If
     
     If doc.mailed(0) = "1" Then
          what = Messagebox("This document has already been mailed to the invitees. Do you want to mail it again?", 36, "Unexpected Condition")
          If what = 7 Then Exit Sub
     End If
     
     Call uidoc.fieldsettext("mailed", "1")
     Call uidoc.save
     
     User = s.UserName
     Subject = doc.MeetingYear(0) & "-" & doc.MeetingMonth(0) & "-" & doc.MeetingType(0)
     
     Call db.OpenMail
     
     Set cdoc = db.CreateDocument
     Call cdoc.ReplaceItemValue("Form","Appointment")
     Call cdoc.ReplaceItemValue("AppointmentType", "3")
     Call cdoc.ReplaceItemValue("_ViewIcon", 158)
     Call cdoc.ReplaceItemValue("Chair", User)
     Call cdoc.ReplaceItemValue("Principal", User)
     Call cdoc.ReplaceItemValue("Subject", Subject)
     Call cdoc.ReplaceItemValue("Topic", Subject)
     Call cdoc.ReplaceItemValue("Body", doc.Agenda & Chr$(13) & Chr$(13) & "Comments : " & doc.Comments)
     Call cdoc.ReplaceItemValue("Location", doc.Location(0))
     Call cdoc.ReplaceItemValue("Room", doc.Location(0) & "/ACE")
     Call cdoc.ReplaceItemValue("SequenceNum",1)
     
     'Start
     Set domDateTime = s.CreateDateTime(doc.MeetDate(0) & " " & doc.MeetTime(0))
     Call cdoc.ReplaceItemValue("CalendarDateTime", domDateTime.LSLocalTime)
     Call cdoc.ReplaceItemValue("StartTime", domDateTime.LSLocalTime)
     Call cdoc.ReplaceItemValue("StartDate",domDateTime.LSLocalTime)
     Call cdoc.ReplaceItemValue("StartDateTime", domDateTime.LSLocalTime)
     
     'End
     Set domDateTime = s.CreateDateTime(doc.MeetDate(0) & " " & doc.MeetTime(1))
     Call cdoc.ReplaceItemValue("EndDateTime", domDateTime.LSLocalTime)
     Call cdoc.ReplaceItemValue("EndDate",domDateTime.LSLocalTime)
     Call cdoc.ReplaceItemValue("EndTime",domDateTime.LSLocalTime)
     
     Set ntitem = cdoc.ReplaceItemValue("ExcludeFromView", "D")
     Call ntitem.AppendToTextList( "S" )
     
     Call cdoc.ReplaceItemValue("RequiredAttendees", doc.SendTo)
     Call cdoc.ReplaceItemValue("OptionalAttendees", doc.CopyTo)
     Call cdoc.ReplaceItemValue("SendTo", doc.SendTo)
     Call cdoc.ReplaceItemValue("CopyTo", doc.CopyTo)
     Call cdoc.ReplaceItemValue("BlindCopyTo", "")
     Call domDateTime.SetNow
     Call cdoc.ReplaceItemValue( "PostedDate", domDateTime.LSLocalTime )
     Call cdoc.ReplaceItemValue( "EnterSendTo", "" )
     Call cdoc.ReplaceItemValue( "EnterCopyTo", "" )
     Call cdoc.ReplaceItemValue( "EnterBlindCopyTo", "" )
     Call cdoc.ReplaceItemValue( "$CSTrack", "Sent" )
     Call cdoc.ReplaceItemValue( "$Mailer", "LN" )
     Call cdoc.ReplaceItemValue( "$MessageID", "automatic@Localdomain" )
     
     Call cdoc.save(True, False, False)
     
     'Envoi invitation
     Set notice = db.CreateDocument
     Call cdoc.CopyAllItems(notice)
     Call notice.ReplaceItemValue("Form","Notice")
     Call notice.ReplaceItemValue("NoticeType","I")
     'Call notice.ReplaceItemValue("UNID",cdoc.UniversalID)
     'Call notice.ReplaceItemValue("ApptUNID",cdoc.UniversalID)
     'Call notice.ReplaceItemValue("$Orig",cdoc.UniversalID)
     
     Call notice.ReplaceItemValue("RequiredAttendees", doc.SendTo)
     Call notice.ReplaceItemValue("OptionalAttendees", doc.CopyTo)
     Call notice.ReplaceItemValue("SendTo", doc.SendTo)
     Call notice.ReplaceItemValue("CopyTo", doc.CopyTo)
     
     Call notice.send(False)
     
     
     Call uidoc.close
     
     Exit Sub
     
ErrorRoutine:
     Messagebox  "Error " & Err() & ":  " & Error()
     Exit Sub
End Sub


Merci d'avance !
CyBeRoN
Posteur néophyte
Posteur néophyte
 
Message(s) : 93
Inscrit(e) le : 24 Mai 2005 à 11:50

Messagepar Stephane Maillard » 20 Août 2007 à 08:29

Salut,

Code à l'air correct, dans l'idée je tenterais un rafraichissement du doc avant l'envoi, je pense que des champs caché doivent être mis à jour. Regarde aussi si il n'y à pas un champs From qui doit être renseigné.
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Messagepar abertisch » 20 Août 2007 à 09:21

IL ne te manque pas le champ Form="Appointment" ?!? :wink:
abertisch
Roi des posts
Roi des posts
 
Message(s) : 763
Inscrit(e) le : 25 Oct 2006 à 13:51
Localisation : Suisse

Messagepar CyBeRoN » 20 Août 2007 à 09:53

abertisch a écrit:IL ne te manque pas le champ Form="Appointment" ?!? :wink:


Set cdoc = db.CreateDocument
Call cdoc.ReplaceItemValue("Form","Appointment")
CyBeRoN
Posteur néophyte
Posteur néophyte
 
Message(s) : 93
Inscrit(e) le : 24 Mai 2005 à 11:50

Messagepar abertisch » 20 Août 2007 à 10:00

CyBeRoN a écrit:
abertisch a écrit:IL ne te manque pas le champ Form="Appointment" ?!? :wink:


Set cdoc = db.CreateDocument
Call cdoc.ReplaceItemValue("Form","Appointment")


Oups désolé je ne l'avais pas vu.
abertisch
Roi des posts
Roi des posts
 
Message(s) : 763
Inscrit(e) le : 25 Oct 2006 à 13:51
Localisation : Suisse

Messagepar CyBeRoN » 20 Août 2007 à 12:34

Ca y'est, j'ai résolu mon problème... à force de patience :)
J'ai repris un à un les champs remplis dans les documents "Appointment" et "Notice".
J'ai remplis ceux-ci mais en laissant le champ SendTo de l'Appointment vide.

Voici donc mon code :

Code : Tout sélectionner
Sub Click(Source As Button)
     On Error Goto ErrorRoutine
     
     Dim s As New NotesSession
     Dim ws As New NotesUIWorkspace
     
     Dim uidoc As NotesUIDocument     
     Dim mdoc As NotesUIDocument 
     Dim db As New NotesDatabase("","")
     Dim doc As NotesDocument, cdoc As NotesDocument, notice As NotesDocument
     
     Dim NTRange As NotesDateRange
     Set NTRange = s.CreateDateRange()
     
     
     Dim User As String, Subject As String
     
     Set uidoc = ws.CurrentDocument
     
     If uidoc.isnewdoc Then Call uidoc.save         
     
     Set doc = uidoc.Document
     
     If doc.MeetDate(0) = "" Then
          Messagebox "You must fill in a meeting date before you mail it.", 64, "Incomplete Information"
          Call uidoc.gotofield("MeetDate")
          Exit Sub
     End If
     
     If doc.MeetTime(0) = "" Then
          Messagebox "You must fill in a meeting time before you mail it.", 64, "Incomplete Information"
          Call uidoc.gotofield("MeetTime")
          Exit Sub
     End If
     
     If doc.SendTo(0) = "" Then
          Messagebox "You must fill in the Invitees for this meeting before you mail it.", 64, "Incomplete Information"
          Call uidoc.gotofield("SendTo")
          Exit Sub
     End If
     
     If doc.mailed(0) = "1" Then
          what = Messagebox("This document has already been mailed to the invitees. Do you want to mail it again?", 36, "Unexpected Condition")
          If what = 7 Then Exit Sub
     End If
     
     Call uidoc.fieldsettext("mailed", "1")
     Call uidoc.save
     
     User = s.UserName
     Subject = doc.MeetingYear(0) & "-" & doc.MeetingMonth(0) & "-" & doc.MeetingType(0)
     
     Call db.OpenMail
     
     Set cdoc = db.CreateDocument
     
     Call cdoc.ReplaceItemValue("Form","Appointment")
     Call cdoc.ReplaceItemValue("AppointmentType", "3")
     Call cdoc.ReplaceItemValue("_ViewIcon", 158)
     
     Call cdoc.ReplaceItemValue("CHAIR", User)
     Call cdoc.ReplaceItemValue("PRINCIPAL", User)
     Call cdoc.ReplaceItemValue("From", User)
     Call cdoc.ReplaceItemValue("tmpChairPerson", User)
     Call cdoc.ReplaceItemValue("TMPOWNER", User)
     Call cdoc.ReplaceItemValue("tmpSentBy", User)
     Call cdoc.ReplaceItemValue("$PrevBusyName", User)
     Call cdoc.ReplaceItemValue("$BusyName", User)
     Call cdoc.ReplaceItemValue("$UpdatedBy", User)
     Call cdoc.ReplaceItemValue("DocAuthors", User)
     
     Call cdoc.ReplaceItemValue("Subject", Subject)
     Call cdoc.ReplaceItemValue("Body", "This is just a test")
     
     Call cdoc.ReplaceItemValue("ROOM", doc.Location(0))
     Call cdoc.ReplaceItemValue("tmpRoom", doc.Location(0))
     Call cdoc.ReplaceItemValue("tmpRoom1", doc.Location(0))
     
     Call cdoc.ReplaceItemValue("SEQUENCENUM", 1)
     Call cdoc.ReplaceItemValue("ExcludeFromView", "D")
     Call cdoc.ReplaceItemValue("$BusyPriority", "1")
     Call cdoc.ReplaceItemValue("$ExpandGroups", "3")
     Call cdoc.ReplaceItemValue("OrgConfidential", "1")
     Call cdoc.ReplaceItemValue("ORGTABLE", "C0")
     Call cdoc.ReplaceItemValue("RoomRequired", "1")
     Call cdoc.ReplaceItemValue("RoomSpecific", "1")
     
     Call cdoc.ReplaceItemValue("REQUIREDATTENDEES", doc.SendTo)
     Call cdoc.ReplaceItemValue("SendTo", "")
     Call cdoc.ReplaceItemValue("tmpSendTo", "")
     Call cdoc.ReplaceItemValue("OPTIONALATTENDEES", doc.CopyTo)
     Call cdoc.ReplaceItemValue("CopyTo", "")
     
     'Start
     Set domDateTime = s.CreateDateTime(doc.MeetDate(0) & " " & doc.MeetTime(0))
     Call cdoc.ReplaceItemValue("CalendarDateTime", domDateTime.LSLocalTime)
     Call cdoc.ReplaceItemValue("StartDate",domDateTime.LSLocalTime)
     Call cdoc.ReplaceItemValue("StartDateTime", domDateTime.LSLocalTime)
     
     Set NTRange.StartDateTime = domDateTime
     
     
     'End
     Set domDateTime = s.CreateDateTime(doc.MeetDate(0) & " " & doc.MeetTime(1))
     Call cdoc.ReplaceItemValue("EndDateTime", domDateTime.LSLocalTime)
     Call cdoc.ReplaceItemValue("$NoPurge",domDateTime.LSLocalTime)
     
     Set NTRange.EndDateTime = domDateTime
     
     Call cdoc.ReplaceItemValue("TimeRange", NTRange)   
     
     Call domDateTime.SetNow
     Call cdoc.ReplaceItemValue( "PostedDate", domDateTime.LSLocalTime )
     
     
     
     Call cdoc.save(True, False, False)
     
     'Envoi invitation
     Set notice = db.CreateDocument
     Call notice.ReplaceItemValue("Form","Notice")
     Call notice.ReplaceItemValue("_ViewIcon", 133)
     Call notice.ReplaceItemValue("RoomToReserve", doc.Location(0))
     Call notice.ReplaceItemValue("TMPAPPTFLAGS", "3")
     Call notice.ReplaceItemValue("tmpAttendeesList", doc.SendTo)
     Call notice.ReplaceItemValue("tmpFrom", User)
     Call notice.ReplaceItemValue("tmpOriginator", User)
     Call notice.ReplaceItemValue("tmpLabel", "Invitation")
     Call notice.ReplaceItemValue("TOPIC", Subject)
     Call notice.ReplaceItemValue("tmpTopic", Subject)
     Call notice.ReplaceItemValue("NoticeType", "I")
     Call notice.ReplaceItemValue("$Orig", cdoc.UniversalId)
     Call notice.ReplaceItemValue("APPTUNID", cdoc.UniversalId)
     notice.UniversalId = cdoc.UniversalId
     
     
     Call notice.ReplaceItemValue("AppointmentType", cdoc.GetItemValue("AppointmentType"))
     Call notice.ReplaceItemValue("$ExpandGroups", cdoc.GetItemValue("$ExpandGroups"))
     Call notice.ReplaceItemValue("$NoPurge", cdoc.GetItemValue("$NoPurge"))
     Call notice.ReplaceItemValue("$UpdatedBy", cdoc.GetItemValue("$UpdatedBy"))
     Call notice.ReplaceItemValue("$NoPurge", cdoc.GetItemValue("$NoPurge"))
     Call notice.ReplaceItemValue("Body", cdoc.GetItemValue("Body"))
     Call notice.ReplaceItemValue("CHAIR", cdoc.GetItemValue("CHAIR"))
     Call notice.ReplaceItemValue("DocAuthors", cdoc.GetItemValue("DocAuthors"))
     Call notice.ReplaceItemValue("EndDateTime", cdoc.GetItemValue("EndDateTime"))
     Call notice.ReplaceItemValue("ExcludeFromView", cdoc.GetItemValue("ExcludeFromView"))
     Call notice.ReplaceItemValue("From", cdoc.GetItemValue("From"))
     Call notice.ReplaceItemValue("ORGCONFIDENTIAL", cdoc.GetItemValue("ORGCONFIDENTIAL"))
     Call notice.ReplaceItemValue("PostedDate", cdoc.GetItemValue("PostedDate"))
     Call notice.ReplaceItemValue("PRINCIPAL", cdoc.GetItemValue("PRINCIPAL"))
     Call notice.ReplaceItemValue("REQUIREDATTENDEES", cdoc.GetItemValue("REQUIREDATTENDEES"))
     Call notice.ReplaceItemValue("ROOM", cdoc.GetItemValue("ROOM"))
     Call notice.ReplaceItemValue("RoomRequired", cdoc.GetItemValue("RoomRequired"))
     Call notice.ReplaceItemValue("RoomSpecific", cdoc.GetItemValue("RoomSpecific"))
     Call notice.ReplaceItemValue("SEQUENCENUM", cdoc.GetItemValue("SEQUENCENUM"))
     Call notice.ReplaceItemValue("StartDate", cdoc.GetItemValue("StartDate"))
     Call notice.ReplaceItemValue("StartDateTime", cdoc.GetItemValue("StartDateTime"))
     Call notice.ReplaceItemValue("TimeRange", cdoc.GetItemValue("TimeRange"))
     Call notice.ReplaceItemValue("tmpRoom", cdoc.GetItemValue("tmpRoom"))
     Call notice.ReplaceItemValue("tmpEndDate", cdoc.GetItemValue("EndDateTime"))
     Call notice.ReplaceItemValue("tmpStartDate", cdoc.GetItemValue("StartDateTime"))
     Call notice.ReplaceItemValue("NewTimeRange", cdoc.GetItemValue("TimeRange"))
     Call notice.ReplaceItemValue("NewDate", cdoc.GetItemValue("StartDateTime"))
     Call notice.ReplaceItemValue("SendTo", doc.SendTo)
     Call notice.ReplaceItemValue("CopyTo", doc.CopyTo)
     Call notice.ReplaceItemValue("Subject", cdoc.GetItemValue("Subject"))
     
     
     Call notice.Send(False)
     
     Call uidoc.close
     
     Exit Sub
     
ErrorRoutine:
     Messagebox  "Error " & Err() & ":  " & Error()
     Exit Sub
End Sub


En espérant que ça puisse aider quelqu'un.

Merci pour vos réponses.
A++
CyBeRoN
Posteur néophyte
Posteur néophyte
 
Message(s) : 93
Inscrit(e) le : 24 Mai 2005 à 11:50

Messagepar Jérome Deniau » 22 Août 2007 à 00:54

A mon avis, tu peux
- Supprimer tous les champ tmpXXXX
- Ne PAS DEFINIR les champs $UpdatedBy, c'est à Notes de le faire
- Supprimer $PrevBusyname (l'utilisateur n'a pas changé de nom entre la création création du doc et la création de l'entrée d'agenda c'est adminp qui se charge de cela......)

Liste des champs impératifs (ensuite on peut ajouter d'autres champ bien sûr)
Form -> impératif si on veut que cela fonctionne non?
Subject
Body
Chair
AltChair
Owner
$PublicAccess -> accès anonyme
AppointmentType
Categories -> Sympa
ExcludeFromView -> si on veut
CalendarDateTime
StartDateTime
StartDate
StartTime
EndDateTime
endDate
EndTime
SequenceNum ->1 mais peut varier
$BusyPriority -> ben oui je ne suis pas dispo
$_ViewIcon -> oui une icône (160?)
$BusyName -> Mettre NotesItem.IsNames à True

Sinon un computewithform pour les fainéants (ultra coûteux en cpu)
Jérome Deniau
 

Merci!

Messagepar nnavez » 15 Nov 2011 à 15:48

MErci mille fois à CyBeRoN pour son code qui vient de me faire gagner des heures de dév avec son dernier code pour les invitations... ca marche nickel!
nnavez
Premier posts
Premier posts
 
Message(s) : 18
Inscrit(e) le : 22 Fév 2007 à 08:00


Retour vers Développement