• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

using outlook 2007 categories through gmail

D

dan knock

#1
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.
 
D

dan knock

#2
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
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
#3
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/en/developers/trigger-actions-with-categories

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

folder:

http://www.vboffice.net/en/developers/categorize-emails-automatically

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