Solved

Outlook - Subject Change Vb.net

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
what is the best portable software where i can test codes written in different languages 1 74
asp Google Map 2 56
AvlTree-Node Data type 4 22
Do Wend Macro not working 22 56
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…

740 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