Outlook: How to archive files using date range?












0














How can I archive emails into .pst files using a date range? I would like to create .pst file for each year.



I'm using MS Outlook 2003.










share|improve this question



























    0














    How can I archive emails into .pst files using a date range? I would like to create .pst file for each year.



    I'm using MS Outlook 2003.










    share|improve this question

























      0












      0








      0







      How can I archive emails into .pst files using a date range? I would like to create .pst file for each year.



      I'm using MS Outlook 2003.










      share|improve this question













      How can I archive emails into .pst files using a date range? I would like to create .pst file for each year.



      I'm using MS Outlook 2003.







      microsoft-outlook microsoft-outlook-2003






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 '11 at 12:02









      atricapillaatricapilla

      4522913




      4522913






















          2 Answers
          2






          active

          oldest

          votes


















          0














          The only way I know is by using MS Outlook archiving tools. You can choose from/to (date) to archive and then name your pst files by name.



          You can't chose from Jan. 1st 2009 to Jan. 1st 2010 but you can archive from now to Jan. 1st 2011. Then, Dec. 31 2010 to Jan. 1st 2010 and so on...






          share|improve this answer





























            0














            While this question is fairly old, I believe the techniques in Robert McMurry's macro would work for this, because it sounds like exactly what the original question is looking for.



            In the interest of trying to prevent the worst losses of bit-rot, here's the relevant block of code. The actual article has much more detail on what it's doing and possible enhancements such as adding recursion; this appears to work on just a single folder ("Inbox") and can probably be used as a starting point.



            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





            share|improve this answer





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "3"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f228541%2foutlook-how-to-archive-files-using-date-range%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              The only way I know is by using MS Outlook archiving tools. You can choose from/to (date) to archive and then name your pst files by name.



              You can't chose from Jan. 1st 2009 to Jan. 1st 2010 but you can archive from now to Jan. 1st 2011. Then, Dec. 31 2010 to Jan. 1st 2010 and so on...






              share|improve this answer


























                0














                The only way I know is by using MS Outlook archiving tools. You can choose from/to (date) to archive and then name your pst files by name.



                You can't chose from Jan. 1st 2009 to Jan. 1st 2010 but you can archive from now to Jan. 1st 2011. Then, Dec. 31 2010 to Jan. 1st 2010 and so on...






                share|improve this answer
























                  0












                  0








                  0






                  The only way I know is by using MS Outlook archiving tools. You can choose from/to (date) to archive and then name your pst files by name.



                  You can't chose from Jan. 1st 2009 to Jan. 1st 2010 but you can archive from now to Jan. 1st 2011. Then, Dec. 31 2010 to Jan. 1st 2010 and so on...






                  share|improve this answer












                  The only way I know is by using MS Outlook archiving tools. You can choose from/to (date) to archive and then name your pst files by name.



                  You can't chose from Jan. 1st 2009 to Jan. 1st 2010 but you can archive from now to Jan. 1st 2011. Then, Dec. 31 2010 to Jan. 1st 2010 and so on...







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 16 '11 at 20:27









                  r0car0ca

                  4,95493463




                  4,95493463

























                      0














                      While this question is fairly old, I believe the techniques in Robert McMurry's macro would work for this, because it sounds like exactly what the original question is looking for.



                      In the interest of trying to prevent the worst losses of bit-rot, here's the relevant block of code. The actual article has much more detail on what it's doing and possible enhancements such as adding recursion; this appears to work on just a single folder ("Inbox") and can probably be used as a starting point.



                      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





                      share|improve this answer


























                        0














                        While this question is fairly old, I believe the techniques in Robert McMurry's macro would work for this, because it sounds like exactly what the original question is looking for.



                        In the interest of trying to prevent the worst losses of bit-rot, here's the relevant block of code. The actual article has much more detail on what it's doing and possible enhancements such as adding recursion; this appears to work on just a single folder ("Inbox") and can probably be used as a starting point.



                        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





                        share|improve this answer
























                          0












                          0








                          0






                          While this question is fairly old, I believe the techniques in Robert McMurry's macro would work for this, because it sounds like exactly what the original question is looking for.



                          In the interest of trying to prevent the worst losses of bit-rot, here's the relevant block of code. The actual article has much more detail on what it's doing and possible enhancements such as adding recursion; this appears to work on just a single folder ("Inbox") and can probably be used as a starting point.



                          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





                          share|improve this answer












                          While this question is fairly old, I believe the techniques in Robert McMurry's macro would work for this, because it sounds like exactly what the original question is looking for.



                          In the interest of trying to prevent the worst losses of bit-rot, here's the relevant block of code. The actual article has much more detail on what it's doing and possible enhancements such as adding recursion; this appears to work on just a single folder ("Inbox") and can probably be used as a starting point.



                          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






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jun 1 '12 at 0:38









                          fencepostfencepost

                          1,08679




                          1,08679






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Super User!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f228541%2foutlook-how-to-archive-files-using-date-range%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Probability when a professor distributes a quiz and homework assignment to a class of n students.

                              Aardman Animations

                              Are they similar matrix