Solved

Outlook - Subject Change Vb.net

Posted on 2012-04-09
4
630 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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

860 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