My team has been converting over our processes from legacy to windows. One of the main issues is missing libraries in Windows, one of them being “Alphabet.Workflow.Activities”. The main activity we used from this was changing an emails current subject line.
I’m trying to do this in windows, but can’t seem to figure it out. I’m using the MicrosoftOffice365.Activities to retrieve my emails:
And then I need to change the subject of them all, to a string variable I have stored. Anyone have any clue?
Just an FYI, this invoke code works for System.Net.Mail.MailMessage variable types:
Dim OlApp As Microsoft.Office.Interop.Outlook.Application
Dim MailItem As microsoft.Office.Interop.Outlook.MailItem
OlApp = New Microsoft.Office.Interop.Outlook.ApplicationClass
MailItem = CType(olapp.Session.GetItemFromID(in_MailMessage.Headers(“uid”)),microsoft.Office.Interop.Outlook.MailItem)
MailItem.Subject=in_NewSubject
MailItem.Save()
But since I’m using the office365 activity, it won’t work exactly.
Dim OlApp As Microsoft.Office.Interop.Outlook.Application
Dim MailItem As Microsoft.Office.Interop.Outlook.MailItem
' Assuming in_MailMessage is an instance of MailMessage class from MicrosoftOffice365.Activities
' and in_NewSubject is a string variable containing the new subject
OlApp = New Microsoft.Office.Interop.Outlook.ApplicationClass
' Retrieve the mail item using UID (assuming UID is a unique identifier for the email)
MailItem = CType(OlApp.Session.GetItemFromID(in_MailMessage.Headers("uid")), Microsoft.Office.Interop.Outlook.MailItem)
' Change the subject
MailItem.Subject = in_NewSubject
' Save the changes
MailItem.Save()
Or
When you retrieve the emails the output will be stored in the list of MailMessages. Run a For Each loop for that variable and you can try using below syntaxin assign activity:
Hey, this does not work, I’m guessing it’s because I’m using Office365 activity, which means the email logged into the system does not match the email I am grabbing emails from.