Outlook: Como arquivar arquivos usando o intervalo de datas?

0

Como posso arquivar e-mails em arquivos .pst usando um período? Eu gostaria de criar um arquivo .pst para cada ano.

Estou usando o MS Outlook 2003.

    
por atricapilla 03.01.2011 / 13:02

2 respostas

0

A única maneira que conheço é usando as ferramentas de arquivamento do MS Outlook. Você pode escolher de / para (data) para arquivar e depois nomear seus arquivos pst pelo nome.

Você não pode escolher entre 1º de janeiro de 2009 e 1º de janeiro de 2010, mas pode arquivar a partir de agora até 1º de janeiro de 2011. Então, 31 de dezembro de 2010 a 1º de janeiro de 2010 e assim por diante ...

    
por 16.02.2011 / 21:27
0

Embora essa questão seja bastante antiga, acredito que as técnicas em A macro de Robert McMurry funcionaria para isso, porque parece exatamente o que a pergunta original está procurando.

No interesse de tentar evitar as piores perdas de podridão de bits, aqui está o bloco de código relevante. O artigo atual tem muito mais detalhes sobre o que está fazendo e possíveis melhorias, como adicionar recursão; isso parece funcionar apenas em uma única pasta ("Caixa de entrada") e provavelmente pode ser usado como ponto de partida.

Sub MoveOldEmails()

    ' Declare all variables.
    Dim objOutlook As Outlook.Application
    Dim objNamespace As Outlook.NameSpace
    Dim objSourceFolder As Outlook.MAPIFolder
    Dim objDestFolder As Outlook.MAPIFolder
    Dim objVariant As Variant
    Dim lngMovedMailItems As Long
    Dim intCount As Integer
    Dim intDateDiff As Integer
    Dim strDestFolder As String

    ' Create an object for the Outlook application.
    Set objOutlook = Application
    ' Retrieve an object for the MAPI namespace.
    Set objNamespace = objOutlook.GetNamespace("MAPI")
    ' Retrieve a folder object for the source folder.
    Set objSourceFolder = objNamespace.GetDefaultFolder(olFolderInbox)

    ' Loop through the items in the folder. NOTE: This has to
    ' be done backwards; if you process forwards you have to
    ' re-run the macro an inverese exponential number of times.
    For intCount = objSourceFolder.Items.Count To 1 Step -1
        ' Retrieve an object from the folder.
        Set objVariant = objSourceFolder.Items.Item(intCount)
        ' Allow the system to process. (Helps you to cancel the
        ' macro, or continue to use Outlook in the background.)
        DoEvents
        ' Filter objects for emails or meeting requests.
        If objVariant.Class = olMail Or objVariant.Class = olMeetingRequest Then
            ' This is optional, but it helps me to see in the
            ' debug window where the macro is currently at.
            Debug.Print objVariant.SentOn
            ' Calculate the difference in years between
            ' this year and the year of the mail object.
            intDateDiff = DateDiff("yyyy", objVariant.SentOn, Now)
            ' Only process the object if it isn't this year.
            If intDateDiff > 0 Then
                ' Calculate the name of the personal folder.
                strDestFolder = "Personal Folders (" & _
                    Year(objVariant.SentOn) & ")"
                ' Retrieve a folder object for the destination folder.
                Set objDestFolder = objNamespace.Folders(strDestFolder).Folders("Inbox")
                ' Move the object to the destination folder.
                objVariant.Move objDestFolder
                ' Just for curiousity, I like to see the number
                ' of items that were moved when the macro completes.
                lngMovedMailItems = lngMovedMailItems + 1
                ' Destroy the destination folder object.
                Set objDestFolder = Nothing
            End If
        End If
    Next

    ' Display the number of items that were moved.
    MsgBox "Moved " & lngMovedMailItems & " messages(s)."

End Sub
    
por 01.06.2012 / 02:38