79186562

Date: 2024-11-13 20:35:52
Score: 0.5
Natty:
Report link

If you have the luxury of working in .NET rather than VBA, and after reading nicely reading outlook mailitem properties I realised that two of these properties can have different values depending on whether the message is in Unicode or not:

//PR_ATTACH_CONTENT_ID          0x3712001E (0x3712001F for Unicode) 
//PR_ATTACH_CONTENT_LOCATION    0x3713001E (0x3713001F for Unicode) 

which means I should include these in my testing for values:

        Dim oPR As Outlook.PropertyAccessor = Nothing

        Try
            oPR = oAtt.PropertyAccessor
            If Not String.IsNullOrEmpty(oPR.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E")) _
            Or Not String.IsNullOrEmpty(oPR.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001F")) _
            Or Not String.IsNullOrEmpty(oPR.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3713001E")) _
            Or Not String.IsNullOrEmpty(oPR.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x3713001F")) Then
                If CInt(oPR.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x37140003")) = 4 Then
                    Return True
                End If
            End If
        Catch
        Finally
            If Not oPR Is Nothing Then
                Try
                    Marshal.ReleaseComObject(oPR)
                Catch

                End Try
            End If
            oPR = Nothing
        End Try

        Return False

I hope that, between this and @Gener4tor 's answer which may be better suited to VBA code (?) a reader can find a solution to their question around this.

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • User mentioned (1): @Gener4tor
  • Low reputation (0.5):
Posted by: DinahMoeHumm