Extraer anexos

Recibo muchos correos con anexos, los cuales tengo que extraer a carpetas de los diferentes remitentes. Saben alguna forma de automatizar esta acción.

1 respuesta

Respuesta
1
Si podes utilizar un agente que corra cada 2 o 3 horas y te los extraiga automaticamente. Te paso el agente:
Sub Initialize
Dim rtitem As Variant
Dim fileCount As Integer
Dim it As NotesItem
Dim filepath As Variant
Dim session As New NotesSession
Dim note As NotesDocument
Dim dbug As NotesLog
Dim db As NotesDatabase
Set sourcedb = session.CurrentDatabase
Set dbug = New NotesLog("Router log")
dbug.LogActions = True
dbug.OpenAgentLog
dbug.LogAction("begin")
Set db = session.CurrentDatabase
Set note = session.DocumentContext
fileCount = 0
Set session = New NotesSession
Set db = session.CurrentDatabase
REM get the incoming mail message
Set docs = db.UnprocessedDocuments
Count = docs.Count
REM if we have new mail start processing
dbug.LogAction("Subject ->" + note.From(0))
If note.From(0) = "CN=Jhon J Luraschi/O=Domain" Then
If docs.Count > 0 Then
For n = 1 To docs.Count
Set memo = docs.GetNthDocument(n)
Set rtitem = memo.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
REM Note how many files we have processed
fileCount = fileCount + 1
If ( o.Type = EMBED_ATTACHMENT ) Then
filepath = "D:\Temp" & o.Name
Call o.ExtractFile( filepath)
Call o.Remove
REM Created a field noting that we removed an attachment
memo.stripped = "yes"
Call memo.Save( True, True )
End If
End Forall
End If ' end loop for rich text objects
Next 'loop for n docs
End If 'end doc count loop
End If
dbug.Close
End Sub
Con este podes extraer archivos de un recipiente especifico. Si no te sirve avisame que te paso uno que te extrae todos los attach sin importar el remitente.
Este Script es solo para extraer archivos, no hace diferenciacion entre los recipientes.
Sub Initialize
Dim rtitem As Variant
Dim fileCount As Integer
Dim it As NotesItem
Dim filepath As Variant
fileCount = 0
Set session = New NotesSession
Set db = session.CurrentDatabase
REM get the incoming mail message
Set docs = db.UnprocessedDocuments
Count = docs.Count
REM if we have new mail start processing
If docs.Count > 0 Then
For n = 1 To docs.Count
Set memo = docs.GetNthDocument(n)
Set rtitem = memo.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Forall o In rtitem.EmbeddedObjects
REM Note how many files we have processed
fileCount = fileCount + 1
If ( o.Type = EMBED_ATTACHMENT ) Then
filepath = "d:\temp\" & o.Name
Call o.ExtractFile( filepath)
Call o.Remove
REM Created a field noting that we removed an attachment
memo.stripped = "yes"
Call memo.Save( True, True )
End If
End Forall
End If ' end loop for rich text objects
Next 'loop for n docs
End If 'end doc count loop
End Sub

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas