?
Solved

i need a script for move the encypted mails from inbox to a specific folder. Encrypted mails are migrated from lotus notes to exchange server 2007 by using third party tool.

Posted on 2009-04-21
11
Medium Priority
?
255 Views
Last Modified: 2012-05-06
i need a script for move the encypted mails from inbox to a specific folder. Encrypted mails are migrated from lotus notes to exchange server 2007 by using third party tool.
0
Comment
Question by:cnuvasu
  • 6
  • 4
10 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 24210670
Hi, cnuvasu.

Are you going to select the encrypted mails?
0
 

Author Comment

by:cnuvasu
ID: 24211667
Hi BlueDevilFan,
Thanks for your quick response......

yeah i'm going to select the encrypted mails from inbox and move the same to a specific folder.
In outlook these encrypted mails are differentiated by x- Classification: which i got it from Message option. I hope this point will be help full for you because this x-Classification is not there in normal message.

0
 
LVL 76

Expert Comment

by:David Lee
ID: 24213214
I can produce a script that'll move the selected messages to another folder.  Why use a script though?  Once the messages are all selected it will be a lot faster to just drag and drop them in the target folder.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:cnuvasu
ID: 24221580
Hi BlueDevilFan,

Yeah, i to agree that drag is faster way to do but why? i'm looking for the script is i need to do this for bulk users. So script will be the best option. Please send me the script it will be usefull for me

Thanks

0
 
LVL 76

Expert Comment

by:David Lee
ID: 24223133
I understand.  Here's the code for doing this.  Let me know which version of Outlook you're using and I'll post instructions for using it.
Sub MoveSelectedItems()
    Dim olkFolder As Outlook.MAPIFolder, intIndex As Integer
    Set olkFolder = Outlook.Session.PickFolder
    If TypeName(olkFolder) = "Nothing" Then
        MsgBox "You must choose a target folder before I can move the selected items.", vbCritical + vbOKOnly, "Move Selected Items"
    Else
        For intIndex = Outlook.Application.ActiveExplorer.Selection.Count To 1 Step -1
            Outlook.Application.ActiveExplorer.Selection.Item(intIndex).Move olkFolder
        Next
    End If
End Sub

Open in new window

0
 

Author Comment

by:cnuvasu
ID: 24238397
Hi BlueDevilFan,

We are using Outlook 2007.  I need script to move the Encrypted mails that are marked with  x- Classification: in Inter header tab. My understanding on the above script is to move the selected items. I'm a correct?

Regards
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24238493
"My understanding on the above script is to move the selected items. I'm a correct?"
Yes, you are correct.

"I need script to move the Encrypted mails that are marked with  x- Classification: in Inter header tab."
I asked in my first response if you were going to select the subject messages.  You said, "yeah".  That's why I wrote the macro to move selected messages instead of selecting them based on a value in the message object.
0
 

Author Comment

by:cnuvasu
ID: 24238543
No, I need to move the mails which are marked in X-Classification: on Internet Heder Tab. Can you please share a script for this.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 24240054
"No, I need to move the mails which are marked in X-Classification: on Internet Heder Tab. Can you please share a script for this."
Ok.  Please think about the questions you're asked before answering them.  It wastes time for both of us if you answer a question one way and then change the answer later.  I'll post the revised code as soon as I can.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 24255601
Replace the code I posted earlier with this version.  To use this

1.  Select the folder containing the subject messages.
2.  Run the macro MoveEncryptedItems.

I don't have any encrypted items, so I can't give this a proper test.  I recommend that you back the items up before trying this.  
Sub MoveEncryptedItems()
    Dim olkFolder As Outlook.MAPIFolder, _
        olkItem As Outlook.MailItem, _
        intIndex As Integer, _
        arrHeaders As Variant, _
        varHeader As Variant
    Set olkFolder = Outlook.Session.PickFolder
    If TypeName(olfFolder) = "Nothing" Then
        MsgBox "You must choose a target folder before I can move the selected items.", vbCritical + vbOKOnly, "Move Selected Items"
    Else
        For intIndex = Outlook.ActiveExplorer.CurrentFolder.Items.Count To 1 Step -1
            Set olkItem = Outlook.ActiveExplorer.CurrentFolder.Items.Item(intIndex)
            arrHeaders = Split(GetInetHeaders(olkItem), vbCrLf)
            For Each varHeader In arrHeaders
                If InStr(1, LCase(varHeader), "x-classification:") Then
                    olkItem.Move olkFolder
                    Exit For
                End If
            Next
        Next
    End If
End Sub
 
Function GetInetHeaders(olkMsg As Outlook.MailItem) As String
    ' Purpose: Returns the internet headers of a message.'
    ' Written: 4/28/2009'
    ' Author:  BlueDevilFan'
    ' Outlook: 2007'
    Const PR_TRANSPORT_MESSAGE_HEADERS = "http://schemas.microsoft.com/mapi/proptag/0x007D001E"
    Dim olkPA As Outlook.PropertyAccessor
    Set olkPA = olkMsg.PropertyAccessor
    GetInetHeaders = olkPA.GetProperty(PR_TRANSPORT_MESSAGE_HEADERS)
    Set olkPA = Nothing
End Function

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question