cancel
Showing results for 
Search instead for 
Did you mean: 

Rename a subject line in outlook.

SakshiShivhare
Level 3

I need to rename an email's subject, the process will pass in the emails EntryID and new subject, then the object should rename the subject of an email and pass out a success or error message.  



------------------------------
Sakshi Shivhare
System engineer
Infosys
Europe/London
------------------------------
4 REPLIES 4

Hi @SakshiShivhare,

You can try below code to rename Email's Subject -
  •  Input Parameter - 1. Entry ID (Text) 2. Subject (Text)
  • Output Parameter - 1. Success (Flag)
18069.png
Code Stage  - 
  1.  Inputs - 18070.png
  2. Outputs - 18071.png
  3.  Code - 
​Dim app = CreateObject("Outlook.Application")
Dim _nameSpace As Microsoft.Office.Interop.Outlook.NameSpace = app.GetNameSpace("MAPI")

Dim item = _nameSpace.GetItemFromID(Entry_ID)

'Below line of code will update the subject line'
item.Subject = Subject

'Below Code will save the updated subject'
item.Save

'Below code will verify the updated subject'
If item.Subject = Subject
Success = True
Else
Success = False
End If

------------------------------
KirtiMaan Talwar
Consultant
Deloitte
------------------------------
KirtiMaan Talwar
IA Consultant
Deloitte USI

@kirtimaantalwar

It is working. Thank you so much ​for the solution.​

------------------------------
Sakshi Shivhare
Application Development Analyst
Accenture

------------------------------

Thanks for sharing the code @kirtimaantalwar
​​

------------------------------
Manpreet Kaur
Manager
Deloitte
*If you find this post helpful mark it as Best Answer
------------------------------

I'm glad to hear everything worked out well 🙂



------------------------------
KirtiMaan Talwar
Consultant
Deloitte
------------------------------
KirtiMaan Talwar
IA Consultant
Deloitte USI