Jaziar
asked on
Script Sending out Attachments in the emails
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("NagL ist", Doc.SendTo)
End If
If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
Set item= Doc.ReplaceItemValue("DocR eaders", Doc.SendTo)
Set Pitem=Doc.ReplaceItemValue ("Private" , "Private")
Call item.AppendToTextList(sess ion.UserNa me)
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("DocRead ers")
Call item.AppendToTextList(mDoc .SendTo)
Call item.AppendToTextList(sess ion.UserNa me)
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
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("NagL
End If
If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
Set item= Doc.ReplaceItemValue("DocR
Set Pitem=Doc.ReplaceItemValue
Call item.AppendToTextList(sess
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("DocRead
Call item.AppendToTextList(mDoc
Call item.AppendToTextList(sess
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
ASKER
I need this logic still
If doc.NagMail(0) = "Yes" Then
Set item = Doc.ReplaceItemValue("NagL ist", Doc.SendTo)
End If
If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
Set item= Doc.ReplaceItemValue("DocR eaders", Doc.SendTo)
Set Pitem=Doc.ReplaceItemValue ("Private" , "Private")
Call item.AppendToTextList(sess ion.UserNa me)
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("DocRead ers")
' Call item.AppendToTextList(mDoc .SendTo)
' Call item.AppendToTextList(sess ion.UserNa me)
' End If
this stuff controls my readers fields and my NagMail
If doc.NagMail(0) = "Yes" Then
Set item = Doc.ReplaceItemValue("NagL
End If
If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
Set item= Doc.ReplaceItemValue("DocR
Set Pitem=Doc.ReplaceItemValue
Call item.AppendToTextList(sess
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("DocRead
' Call item.AppendToTextList(mDoc
' Call item.AppendToTextList(sess
' End If
this stuff controls my readers fields and my NagMail
You may just be able to do a doc.RemoveItem("$FILE") after the CopyAllItems call ... if that is what is holding your attachments.
ASKER
that did not work - but please keep trying - I need to get this working
What's the logic for? It works on doc, and you don't save doc afterwards, so the changes you make are useless...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yep that worked
ASKER
The logic is
If doc.NagMail(0) = "Yes" Then
' Set item = Doc.ReplaceItemValue("NagL ist", 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("DocR eaders", Doc.SendTo)
Set Pitem=Doc.ReplaceItemValue ("Private" , "Private")
Call item.AppendToTextList(sess ion.UserNa me)
End If
This populates the readers field if the viewing is restricted
If doc.ViewBy(0) = "No Restrictions (All)" Then
' Set item = mDoc.GetFirstItem("DocRead ers")
' Call item.AppendToTextList(mDoc .SendTo)
' Call item.AppendToTextList(sess ion.UserNa me)
' End If
This just leaves it set to [Everyone]
Not sure how they work but they do
If doc.NagMail(0) = "Yes" Then
' Set item = Doc.ReplaceItemValue("NagL
' 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("DocR
Set Pitem=Doc.ReplaceItemValue
Call item.AppendToTextList(sess
End If
This populates the readers field if the viewing is restricted
If doc.ViewBy(0) = "No Restrictions (All)" Then
' Set item = mDoc.GetFirstItem("DocRead
' Call item.AppendToTextList(mDoc
' Call item.AppendToTextList(sess
' End If
This just leaves it set to [Everyone]
Not sure how they work but they do
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("NagL
' End If
' If doc.ViewBy(0) = "Viewing Restricted (To: Recipients Only)" Then
' Set item= Doc.ReplaceItemValue("DocR
' Set Pitem=Doc.ReplaceItemValue
' Call item.AppendToTextList(sess
' 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("DocRead
' Call item.AppendToTextList(mDoc
' Call item.AppendToTextList(sess
' 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