?
Solved

Script Sending out Attachments in the emails

Posted on 2005-05-17
8
Medium Priority
?
299 Views
Last Modified: 2013-12-18
This script is sending out all attachments in the form with the email.  I dont want it to do that.  I just want the message and the doclink.  But I am not sure where it is picking up the attachments to.

Sub Click(Source As Button)
      Dim ws As New NotesUIWorkspace
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim uiDoc As NotesUIDocument
      Dim doc As NotesDocument
      Dim mDoc As NotesDocument
      Dim rtitem As NotesRichTextItem
      Set uiDoc = ws.CurrentDocument
      Call uiDoc.Save
      Set doc = uiDoc.Document
      Set db = session.CurrentDatabase
      Set mDoc = New NotesDocument(db)
      If doc.NagMail(0) = "Yes" Then
            Set item = Doc.ReplaceItemValue("NagList", Doc.SendTo)
      End If
      If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
            Set item= Doc.ReplaceItemValue("DocReaders", Doc.SendTo)
            Set Pitem=Doc.ReplaceItemValue("Private", "Private")      
            Call item.AppendToTextList(session.UserName)
      End If
      
      doc.CreateFlag = No      
      'Set db = session.CurrentDatabase
      'Set mDoc = New NotesDocument(db)
      
      Call doc.CopyAllItems(mDoc)      
      If doc.ViewBy(0) = "No Restrictions (All)" Then
            Set item = mDoc.GetFirstItem("DocReaders")
            Call item.AppendToTextList(mDoc.SendTo)
            Call item.AppendToTextList(session.UserName)
      End If
      'mDoc.Form = doc.Subject
      mDoc.Subject = doc.Subject      
      mDoc.Form = "Memo"
      mDoc.SourceDocument = doc.UniversalID
      mDoc.SenderList = session.CommonUserName      
      Set rtitem = New NotesRichTextItem(mDoc, "Body" )
      Call rtitem.AppendText( "Your Attention Has Been Requested.")
      Call rtitem.AddNewLine(1)      
      Call rtitem.AppendText( "Please Click the link below to view the action.")
      Call rtitem.AddNewLine(2)            
      Call rtitem.AppendDocLink(doc, "PS&SD Dev. Budget Database Link" )      
      Call mDoc.Send(True)
      Call uiDoc.Close(True)
End Sub

The Attachment Field is called RequestAttachments
0
Comment
Question by:Jaziar
  • 4
  • 2
  • 2
8 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 14020260
The CopyAllItems does that. :) I think some other things can be removed as well, I commented them out, and you need to specify some SendTo somewhere.

Sub Click(Source As Button)
     Dim ws As New NotesUIWorkspace
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim uiDoc As NotesUIDocument
     Dim doc As NotesDocument
     Dim mDoc As NotesDocument
     Dim rtitem As NotesRichTextItem
     Set uiDoc = ws.CurrentDocument
     Call uiDoc.Save
     Set doc = uiDoc.Document
     Set db = session.CurrentDatabase
     Set mDoc = New NotesDocument(db)
'     If doc.NagMail(0) = "Yes" Then
'          Set item = Doc.ReplaceItemValue("NagList", Doc.SendTo)
'     End If
'     If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
'          Set item= Doc.ReplaceItemValue("DocReaders", Doc.SendTo)
'          Set Pitem=Doc.ReplaceItemValue("Private", "Private")    
'          Call item.AppendToTextList(session.UserName)
'     End If
     
'     doc.CreateFlag = No    
     'Set db = session.CurrentDatabase
     'Set mDoc = New NotesDocument(db)
     
'     Call doc.CopyAllItems(mDoc)    
'     If doc.ViewBy(0) = "No Restrictions (All)" Then
'          Set item = mDoc.GetFirstItem("DocReaders")
'          Call item.AppendToTextList(mDoc.SendTo)
'          Call item.AppendToTextList(session.UserName)
'     End If
     'mDoc.Form = doc.Subject
' added start
     mdoc.SendTo= doc.SendTo
' added end
     mDoc.Subject = doc.Subject    
     mDoc.Form = "Memo"
     mDoc.SourceDocument = doc.UniversalID
     mDoc.SenderList = session.CommonUserName    
     Set rtitem = New NotesRichTextItem(mDoc, "Body" )
     Call rtitem.AppendText( "Your Attention Has Been Requested.")
     Call rtitem.AddNewLine(1)    
     Call rtitem.AppendText( "Please Click the link below to view the action.")
     Call rtitem.AddNewLine(2)          
     Call rtitem.AppendDocLink(doc, "PS&SD Dev. Budget Database Link" )    
     Call mDoc.Send(True)
     Call uiDoc.Close(True)
End Sub
0
 

Author Comment

by:Jaziar
ID: 14020669
I need this logic still

     If doc.NagMail(0) = "Yes" Then
          Set item = Doc.ReplaceItemValue("NagList", Doc.SendTo)
     End If
     If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
          Set item= Doc.ReplaceItemValue("DocReaders", Doc.SendTo)
          Set Pitem=Doc.ReplaceItemValue("Private", "Private")    
          Call item.AppendToTextList(session.UserName)
     End If
     
     doc.CreateFlag = No    
     'Set db = session.CurrentDatabase
     'Set mDoc = New NotesDocument(db)
     
'     Call doc.CopyAllItems(mDoc)    
'     If doc.ViewBy(0) = "No Restrictions (All)" Then
'          Set item = mDoc.GetFirstItem("DocReaders")
'          Call item.AppendToTextList(mDoc.SendTo)
'          Call item.AppendToTextList(session.UserName)
'     End If

this stuff controls my readers fields and my NagMail
0
 
LVL 3

Expert Comment

by:mssturgeon
ID: 14021881
You may just be able to do a doc.RemoveItem("$FILE") after the CopyAllItems call ... if that is what is holding your attachments.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:Jaziar
ID: 14021990
that did not work - but please keep trying - I need to get this working
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 14022033
What's the logic for? It works on doc, and you don't save doc afterwards, so the changes you make are useless...
0
 
LVL 3

Accepted Solution

by:
mssturgeon earned 600 total points
ID: 14022053
Sorry, just looked again at you code.  Technically, that shiould have been mDoc.RemoveItem("$FILE")
0
 

Author Comment

by:Jaziar
ID: 14022096
Yep that worked
0
 

Author Comment

by:Jaziar
ID: 14022113
The logic is

 If doc.NagMail(0) = "Yes" Then
'          Set item = Doc.ReplaceItemValue("NagList", Doc.SendTo)
'     End If

If they select yes and puts the SendTo names in the NagList Field

 If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
          Set item= Doc.ReplaceItemValue("DocReaders", Doc.SendTo)
          Set Pitem=Doc.ReplaceItemValue("Private", "Private")    
          Call item.AppendToTextList(session.UserName)
     End If

This populates the readers field if the viewing is restricted

 If doc.ViewBy(0) = "No Restrictions (All)" Then
'          Set item = mDoc.GetFirstItem("DocReaders")
'          Call item.AppendToTextList(mDoc.SendTo)
'          Call item.AppendToTextList(session.UserName)
'     End If

This just leaves it set to [Everyone]

Not sure how they work but they do
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question