using outlook 2007 categories through gmail

  • Thread starter Thread starter dan knock
  • Start date Start date
D

dan knock

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.
Submitted using http://www.outlookforums.com
 
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
 
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 - MVP Outlook
Manage and share your categories:
<http://www.vboffice.net/product.html?pub=6&lang=en>


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
.
Submitted using http://www.outlookforums.com
 
Back
Top