Parker Software Ltd Homepage
Forum Home Forum Home > Email2DB Email Parser > Scripting > Scripting Samples
  New Posts New Posts RSS Feed: Getting Related Item Information
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Getting Related Item Information

 Post Reply Post Reply
Author
Message
Daniel View Drop Down
Admin Group
Admin Group
Avatar
Technical Director

Joined: 19 Dec 2006
Location: Stoke-on-Trent
Posts: 875
Post Options Post Options   Quote Daniel Quote  Post ReplyReply Direct Link To This Post Topic: Getting Related Item Information
    Posted: 13 Jun 2012 at 10:13am
If you want to extract information about where your related items have been saved to, you can use a script like this after your save action has executed:
    Dim I As Integer
    Dim SavedTo As String
    For I = 1 To Email2DBMessage.RelatedItems.Count
        SavedTo = SavedTo & Email2DBMessage.RelatedItems(I).SavedTo & ";"
    Next I
Daniel Tallentire
Support
Parker Software
Back to Top
MarcPryde View Drop Down
New User
New User


Joined: 02 Aug 2012
Posts: 3
Post Options Post Options   Quote MarcPryde Quote  Post ReplyReply Direct Link To This Post Posted: 14 Aug 2012 at 12:10am
Using the info given, I modified the original scripting example to work.  Below is a customized code snippet for the Attachments table used locally.  Thank you for the help.
 
A couple of notes that I was curious about. 
 
[1]  .Size appears to return 0 bytes and therefore, I was unable to leave in the original If Len(attachment)>0 then statement.
 
[2] .SaveTo appears to be empty and I substituted this for Location which is filled in.
 
Any clarity that you can bring to these two notes is appreciated.
 
 
For A=1 To Email2DBMessage.RelatedItems.Count
Attachments.AddNew
Attachments.Fields("Attachment_Issue")= FIELDS_Value("WorkOrderID")
Attachments.Fields("Filename")=Email2DBMessage.RelatedItems(A).Name

Set myStream = New ADODB.Stream
myStream.Type = adTypeBinary
myStream.Open
myStream.LoadFromFile(Email2DBMessage.RelatedItems(A).Location)
Attachments.Fields("Data")=myStream.Read
Attachments.Fields("Miscellaneous")="Size of file in bytes: " & myStream.Size
myStream.Close

file_ext = Email2DBMessage.RelatedItems(A).FileExtension
Attachments.Fields("FileExtension")= file_ext
Attachments.Update

Next A

Back to Top
Liam View Drop Down
Admin Group
Admin Group
Avatar

Joined: 29 Jun 2011
Location: Stoke-on-Trent
Posts: 144
Post Options Post Options   Quote Liam Quote  Post ReplyReply Direct Link To This Post Posted: 05 Oct 2012 at 6:57am
Hello MarcPryde,
 
1. The size property doesn't seem to work correctly for content type image at the moment, I have reported this to the developers who will take a look further look into this.
This does appear to work correctly for other content types.
 
2. the SaveTo does seem to work from my tests.
This would only contain data if you have a Process Attachments action which has "Include Inline Attachments" checked and this Process Attachments action was processed before the Run An Email2DB Script item.
Back to Top
James Horton View Drop Down
Admin Group
Admin Group
Avatar
Technical Support

Joined: 01 Jun 2009
Location: Stoke-on-Trent
Posts: 277
Post Options Post Options   Quote James Horton Quote  Post ReplyReply Direct Link To This Post Posted: 21 Dec 2012 at 9:36am
I am un-sure if this was confirmed else where but the Content Type now functions as required in this area.

Thank you,

James


Edited by James Horton - 03 Jan 2013 at 10:49am
Best Regards,

James Horton
Technical Analyst
Parker Software
Back to Top
James Horton View Drop Down
Admin Group
Admin Group
Avatar
Technical Support

Joined: 01 Jun 2009
Location: Stoke-on-Trent
Posts: 277
Post Options Post Options   Quote James Horton Quote  Post ReplyReply Direct Link To This Post Posted: 03 Jan 2013 at 10:16am
Here is a break down of each of the RelatedItems(COUNT). properties:

ContentType
This will be the content type delcarations, such as what would be seen within the MIME text for the file e.g. image/jpg

Data
This contains the raw byte data for the item selected.

FileExtension
Extension type such as gif.

FileNameWithoutExtension
File name minus the extension type.

IsAttachedMessage
Boolean to represent whether it is an attached email message.

IsRelatedItem
Boolean to represent whether it is a related item or not.

Location
Temporary storage location for the attachment while processing. Used to save to a perminant directory.

Name
Full file name of the item

RelatedContentID
This is the ID of the content item within the message e.g. image001.gif@01CDE993.D8564850

RenameTo
Optional variable for you to set during the process so that it takes on another name.

SavedTo
Optional variable for you to set during the process so that it is saved to a particular directory.

Size
File size of the item quoted in bytes. 

Edited by James Horton - 03 Jan 2013 at 10:17am
Best Regards,

James Horton
Technical Analyst
Parker Software
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.141 seconds.
These are the forums for Parker Software, developers of Live Chat Software: WhosOn and Email Automation Software: Email2DB.