cancel
Showing results for 
Search instead for 
Did you mean: 

MAPIEx VBO - Mail Classification

Ashis_KumarRay
Level 4
Currently our BP Process uses Blue Prism MAPIEx object to send email to outside of the company. But now our client wants to classify the mail I.e. Internal, Public, Confidential etc. before sending any Email to outside of company through BP process. Could anyone please let me know how to achieve this one by using any VBO or anything else? Note: Currently when we send any email through Outlook manually it asks for classification thus Client demands for the same way should BP use. Thanks
23 REPLIES 23

AmiBarrett
Level 12
That makes more sense, then. I'd be curious to see the construction of OutMail though, since ""Send Item"" declares it as mail. If you've replaced all references of ""mail"" with ""OutMail"", it should be fine - but my suspicion is that you have both objects, ""mail"" and ""OutMail"" in the code, and only ""mail"" is getting sent. Is there any way you can paste the entire code stage?

Ashis_KumarRay
Level 4
Here is the Code stage. I have only added two lines into the VBO code which is highlighted. Try     Dim OutApp as Object = CreateObject(""Outlook.Application"")     Dim OutMail as Object = OutApp.CreateItem(0)     Dim OutAtt as Object = OutMail.Attachments     With OutMail         .to = [To]         .CC = [CC]         .BCC = [BCC]         .Subject = [Subject]         if [HTMLFormat] then             .HTMLBody = [Message]             .bodyformat = 2         else             .Body = [Message]         end if     if [SendOnBehalfName] """" then         .SentOnBehalfOfName = SendOnBehalfName     end if     End With          For Each R As DataRow in Attachments.Rows         dim file As String = CStr(R(""Path""))         OutAtt.Add (file)     Next               If SharedMailBoxNumber 1         OutMail.SendUsingAccount = OutApp.Session.Accounts.Item(SharedMailBoxNumber)     End If          OutMail.ItemProperties.Add(""Classification"",1)      OutMail.ItemProperties.item(""Classification"").Value = ""Confidential""               OutMail = Nothing     OutApp = Nothing     Success = True Catch ex As System.Exception     ErrMessage = ex.Message End Try

AmiBarrett
Level 12
This is entirely different from the version of the Outlook VBO I grabbed, but I think I see the problem(s). First and foremost, those two lines you've added are after where it has sent the mail. In the If block above, it calls SendUsingAccount, which is effectively another way of doing OutMail.Send. Since you're making modifications to the message object after that is executed, it doesn't really have any effect. Second, I don't see a handle for any case where SharedMailBoxNumber = 1. You could probably duplucate that if block, say if = 1, then replace the second line of it to just say OutMail.Send . 

Ashis_KumarRay
Level 4
Sorry Ami, I think in the last email by mistake the line ""Outmail.Send"" got deleted. here is the code below which I have used just now and still not able to classify. I have moved the two line above as well. Please let me know your view Try     Dim OutApp as Object = CreateObject(""Outlook.Application"")     Dim OutMail as Object = OutApp.CreateItem(0)     Dim OutAtt as Object = OutMail.Attachments     With OutMail         .to = [To]         .CC = [CC]         .BCC = [BCC]         .Subject = [Subject]         if [HTMLFormat] then             .HTMLBody = [Message]             .bodyformat = 2         else             .Body = [Message]         end if     OutMail.ItemProperties.Add(""Classification"",1)      OutMail.ItemProperties.item(""Classification"").Value = ""Confidential""     if [SendOnBehalfName] """" then         .SentOnBehalfOfName = SendOnBehalfName     end if     End With          For Each R As DataRow in Attachments.Rows         dim file As String = CStr(R(""Path""))         OutAtt.Add (file)     Next          If SharedMailBoxNumber 1         OutMail.SendUsingAccount = OutApp.Session.Accounts.Item(SharedMailBoxNumber)     End If          OutMail.Send             OutMail = Nothing     OutApp = Nothing     Success = True Catch ex As System.Exception     ErrMessage = ex.Message End Try

AmiBarrett
Level 12
You've moved it into the With OutMail block. If it's in there, you can change it from OutMail.ItemProperties to .ItemProperties . 

Ashis_KumarRay
Level 4
Ami, i used the both the ways i.e. Kept the OutMail.ItemProperties outside of With Outmail block and kept inside but replaced from OutMail.ItemProperties to .ItemProperties but unfortunately both are not able to classify. Do you have any other code stage which you are using currently for classification or are you using different Outlook VBO for your requirement which I can also try. Please let me know your comments. Try     Dim OutApp as Object = CreateObject(""Outlook.Application"")     Dim OutMail as Object = OutApp.CreateItem(0)     Dim OutAtt as Object = OutMail.Attachments     With OutMail         .to = [To]         .CC = [CC]         .BCC = [BCC]         .Subject = [Subject]         if [HTMLFormat] then             .HTMLBody = [Message]             .bodyformat = 2         else             .Body = [Message]         end if         .ItemProperties.Add(""Classification"",1)          .ItemProperties.item(""Classification"").Value = ""Confidential""         if [SendOnBehalfName] """" then         .SentOnBehalfOfName = SendOnBehalfName     end if     End With     'OutMail.ItemProperties.Add(""Classification"",1)      'OutMail.ItemProperties.item(""Classification"").Value = ""Confidential""          For Each R As DataRow in Attachments.Rows         dim file As String = CStr(R(""Path""))         OutAtt.Add (file)     Next          If SharedMailBoxNumber 1         OutMail.SendUsingAccount = OutApp.Session.Accounts.Item(SharedMailBoxNumber)     End If          OutMail.Send             OutMail = Nothing     OutApp = Nothing     Success = True Catch ex As System.Exception     ErrMessage = ex.Message End Try  

AmiBarrett
Level 12
I pulled a list of MailItem properties on one of my messages. the property in question is ""Sensitivity"", rather than ""Classification"". The value for these are in integers, defaulting to 0. This property happens to have an index of 24. You should be able to say .ItemProperties.item(24).Value = 1 , or whatever the value should be. I would recommend finding one mail that's already properly classified and run this code to see what your index and value need to be.

for i = 0 to item.ItemProperties.Count - 1
	if CStr(item.ItemProperties.Item(i).Name) = ""Sensitivity"" then
		csv = csv & CStr(item.ItemProperties.Item(i).Value)
		csv = csv & "" | "" & CStr(i)
	end if
next​

Ashis_KumarRay
Level 4
Hi Ami, I have checked the property ""Sensitivity"" which is 24th Index of Item properties list and every time I get value 0. I checked for classified mail i.e. Internal, Confidential and also checked for a non-classified email. No luck till this point. Please let me know your view. I have attached all my property list here. We are able to do this classification through Macro. Can we not add those code macro code to BP? 

AmiBarrett
Level 12
Depending how you've done the macro, the code should be the same as it is in BP. If all else, you can set the default classification in your Outlook preferences, provided you don't mind it always being the same.

Ashis_KumarRay
Level 4
Is there any way to set up default Preference as ""Confidential"" in outlook. Currently our all outbound email should be classified as ""Confidential"". Could you please let me know the steps? I am using Microsoft Outlook 2010.