Solved

Outlook - Subject Change Vb.net

Posted on 2012-04-09
4
624 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is an explanation of a simple data model to help parse a JSON feed
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 …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now