Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: Wed, 31 Oct 2007 13:39:02 -0000,    group: microsoft.public.exchange.applications        back       


VBS to move mail from Exchange Mailbox's Inbox to a Public Folder   
I would like VB scripts to move and copy an email received in any
user's Inbox to a specific sub-folder of the Public Folders, ie:

Mailbox - Bob Jones>Inbox -- move to --> Public Folders>Public
Folders>GFI Antispam Folders>This is spam email

The closest I've come to a script that works is the following, which
moves mail from the Inbox to a sub-folder of the Inbox (in this
instance Keep).

==START==
Sub MoveSelectedMessagesToFolder()

On Error Resume Next





    Dim objFolder As Outlook.MAPIFolder, objInbox As
Outlook.MAPIFolder

    Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem





    Set objNS = Application.GetNamespace("MAPI")

    Set objInbox = objNS.GetDefaultFolder(olFolderInbox)

    Set objFolder = objInbox.Folders("Keep")











'Assume this is a mail folder


    If objFolder Is Nothing Then

        MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
"INVALID FOLDER"

    End If





    If Application.ActiveExplorer.Selection.Count = 0 Then

        'Require that this procedure be called only when a message is
selected

        Exit Sub

    End If





    For Each objItem In Application.ActiveExplorer.Selection

        If objFolder.DefaultItemType = olMailItem Then

            If objItem.Class = olMail Then

                objItem.Move objFolder

            End If

        End If

    Next








    Set objItem = Nothing

    Set objFolder = Nothing

    Set objInbox = Nothing

    Set objNS = Nothing

End Sub

==END==
date: Wed, 31 Oct 2007 13:39:02 -0000   author:   unknown

RE: VBS to move mail from Exchange Mailbox's Inbox to a Public Folder   
Hi,

I am currently working on a project to move vaulted stubs from a public 
folder to a mailbox. The catch is that I need to create the same folder name 
prior to move.  
Since this is the first time I have done a scripted move, I am looking for 
any advice or assistance I can get with this. 

We're you able to get this to work?

thanks in advance for your time.

Don

"AlexCottrill@googlemail.com" wrote:

> I would like VB scripts to move and copy an email received in any
> user's Inbox to a specific sub-folder of the Public Folders, ie:
> 
> Mailbox - Bob Jones>Inbox -- move to --> Public Folders>Public
> Folders>GFI Antispam Folders>This is spam email
> 
> The closest I've come to a script that works is the following, which
> moves mail from the Inbox to a sub-folder of the Inbox (in this
> instance Keep).
> 
> ==START==
> Sub MoveSelectedMessagesToFolder()
> 
> On Error Resume Next
> 
> 
> 
> 
> 
>     Dim objFolder As Outlook.MAPIFolder, objInbox As
> Outlook.MAPIFolder
> 
>     Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
> 
> 
> 
> 
> 
>     Set objNS = Application.GetNamespace("MAPI")
> 
>     Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> 
>     Set objFolder = objInbox.Folders("Keep")
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 'Assume this is a mail folder
> 
> 
>     If objFolder Is Nothing Then
> 
>         MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> "INVALID FOLDER"
> 
>     End If
> 
> 
> 
> 
> 
>     If Application.ActiveExplorer.Selection.Count = 0 Then
> 
>         'Require that this procedure be called only when a message is
> selected
> 
>         Exit Sub
> 
>     End If
> 
> 
> 
> 
> 
>     For Each objItem In Application.ActiveExplorer.Selection
> 
>         If objFolder.DefaultItemType = olMailItem Then
> 
>             If objItem.Class = olMail Then
> 
>                 objItem.Move objFolder
> 
>             End If
> 
>         End If
> 
>     Next
> 
> 
> 
> 
> 
> 
> 
> 
>     Set objItem = Nothing
> 
>     Set objFolder = Nothing
> 
>     Set objInbox = Nothing
> 
>     Set objNS = Nothing
> 
> End Sub
> 
> ==END==
> 
>
date: Wed, 2 Jan 2008 06:41:02 -0800   author:   Don Tweedie Don

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us