1. Here's a thread that needs an answer: Advanced Search Question

using outlook 2007 categories through gmail

Discussion in 'Outlook VBA and Custom Forms' started by dan knock, Mar 1, 2010.

  1. dan knock

    dan knock

    Guest
    hi everyone,

    I would like to find a way to keep outlook 2007 categories through gmail.

    Gmail use label which are show as folders in outlook.

    So it's "simple": when I put a category to an email, a script could copy this email to the right mapi folder in Gmail.

    in others PCs a script could put automatically a category to every email which are into this folder:

    ex: I put "urgent" category to an email ->copy this email to "urgent" gmail folder

    and then: in others PCs every email in "urgent" gmail folder could set to "urgent" category.

    the only pb... I don't know how to do that in VBA for outlook 2007.

    Someone could help me ?

    I'm convinced that many other users could be interested.

    greeting.

     
  2. dan knock

    dan knock

    Guest
    I've found this:

    It move every categorised email to a specific folder (urgent ou boulot).

    beware: this script freeze outlook a long time to achieve the operation.

    I need to link it with the event "user has check a new email in a specific folder"... if you know how, tell me :)

    Sub MoveItems()

    Dim myNamespace As Outlook.NameSpace

    Dim myFolder As Outlook.Folder

    Dim myItems As Outlook.Items

    Dim myRestrictItems As Outlook.Items

    Dim myItem As Outlook.MailItem

    Dim racine As Outlook.Folder

    Set myNamespace = Application.GetNamespace("MAPI")

    Set myFolder = _

    myNamespace.GetFolderFromID(ActiveExplorer.CurrentFolder.EntryID)

    Set myItems = myFolder.Items

    Set racine = myFolder.Parent

    Set myRestrictItems = myItems.Restrict("[Cat├ęgories] = 'urgent ou boulot'")

    For i = myRestrictItems.Count To 1 Step -1

    myRestrictItems(i).Move racine.Folders("urgent ou boulot")

    Next

    End Sub

     
  3. Michael Bauer

    Michael Bauer

    Senior Member
    This example moves an item as soon as you categorize it. You could adopt it,

    and just copy the item instead:

    http://www.vboffice.net/sample.html?lang=en&mnu=2&smp=70&cmd=showitem

    This one shows how to assign a category as soon as it gets into a certain

    folder:

    http://www.vboffice.net/sample.html?lang=en&mnu=2&smp=42&cmd=showitem

    If you know exactly how many folders you want to watch, you could use one

    Items variable for each. For instance:

    Private WithEvents Items_1 As Outlook.Items

    Private WithEvents Items_2 As Outlook.Items

    etc.

    In Application-Startup you'd have to set every of these variables to the

    Items collection of one folder.

    Best regards

    Michael Bauer

    Am Mon, 01 Mar 2010 12:44:16 -0500 schrieb dan knock:


    > I've found this:
    > It move every categorised email to a specific folder (urgent ou boulot).
    > beware: this script freeze outlook a long time to achieve the operation.
    > I need to link it with the event "user has check a new email in a specific


    folder"... if you know how, tell me :)

    > Sub MoveItems()
    > Dim myNamespace As Outlook.NameSpace
    > Dim myFolder As Outlook.Folder
    > Dim myItems As Outlook.Items
    > Dim myRestrictItems As Outlook.Items
    > Dim myItem As Outlook.MailItem
    > Dim racine As Outlook.Folder

    > Set myNamespace = Application.GetNamespace("MAPI")
    > Set myFolder = _
    > myNamespace.GetFolderFromID(ActiveExplorer.CurrentFolder.EntryID)

    > Set myItems = myFolder.Items
    > Set racine = myFolder.Parent
    > Set myRestrictItems = myItems.Restrict("[Cat├ęgories] = 'urgent ou


    boulot'")

    > For i = myRestrictItems.Count To 1 Step -1
    > myRestrictItems(i).Move racine.Folders("urgent ou boulot")
    > Next
    > End Sub
    > .
    >


     
Similar Threads
Forum Title Date
Using Outlook 0x800CCC0F Error using POP3 in Outlook 2010 and 2013 Oct 23, 2014
Using Outlook Can't send messages using Outlook 2007 from a business email Oct 9, 2014
Using Outlook.com accounts in Outlook Outlook 2013 and outlook.com issues when using mail alias Sep 29, 2014
Using Outlook Disappearing data from outlook calendar after using icloud-ical Sep 21, 2014
Using Outlook Using Follup in Custom Forms Outlook 2013 Sep 16, 2014

Share This Page