Solved

Outlook - Subject Change Vb.net

Posted on 2012-04-09
4
629 Views
Last Modified: 2012-08-02
'http://www.codeproject.com/Articles/13439/Extracting-mails-and-attachments-from-outlook-2003

I got this code snippet from the above site.
 Dim objOL As Application
        Dim objNS As Outlook.NameSpace
        Dim myItems As Items
        Dim x As Int16

        objOL = New Application()
        objNS = objOL.GetNamespace("MAPI")

        Dim olfolder As MAPIFolder
        olfolder = objOL.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderInbox)

        myItems = olfolder.Items

        For x = myItems.Count To 1 Step -1
            If myItems.Item(x).To.ToString.Contains("Username") Then
                MsgBox(myItems.Item(x).SenderName)
                MsgBox(myItems.Item(x).Subject)
            End If
        Next x

Open in new window


However, what I want to do is when it meets the condition of the to field containts what ever the user's name is, I want it to change the subject of the item (in outlook 2010/2007) to

"In progress " + what ever the original subject name was.

So the part I don't know how to do is the change subject name to something different. Can anyone help me in this please.

Thanks.
0
Comment
Question by:BoltonWanderer
4 Comments
 

Accepted Solution

by:
BoltonWanderer earned 0 total points
ID: 37823207
Just tried something. Is it this simple.

 
Dim oldsub = myItems.Item(x).Subject
            myItems.Item(x).Subject = "In Progress" & oldsub 
            myItems.Item(x).Save()

Open in new window

0
 
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 500 total points
ID: 37827101
yes it should be as Subject is  a writable property. http://msdn.microsoft.com/en-us/library/bb176688%28v=office.12%29.aspx

My experience is with CDO / MAPI but works the same.  http://oreilly.com/catalog/cdomapi/chapter/ch07.html  has a writable subject.

read the part about object instantiation as well.
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 38249581
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

776 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