Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 11 of 11

Thread: Save all attachments from SC to local folder

  1. #1
    Administrator tommy's Avatar
    Join Date
    Nov 2001
    Location
    Copenhagen
    Posts
    4,272

    Default Save all attachments from SC to local folder

    The attached scenario will save all attachments in Incidents to a local folder.

    Before running it You must configure the connector to Your environment. You also need to modify the mapping to suit Your needs of filenaming.


    Code:
    Dim iItem as Integer
    Dim iCount as Integer
    Dim sFiles as String
    sFiles =""
    iCount = pifGetItemCount("attachments")
    For iItem = 0 to iCount - 1
      iRc=pifWriteBlobInFile("attachments(" & iItem & ").attachment", "d:\temp\attachments\IM\IM" & [number] & " " & iItem & " "  & [attachments(iItem).name])
      sFiles = sFiles & ";" & "d:\temp\attachments\IM\IM" & [number] & " " & iItem & " "  & [attachments(iItem).name]
    Next
    RetVal = [number] & " Attachments#: " & iCount & " Filenames: " & sFiles
    The scenario is designed for incidents but can easily be changed for any other files. Just change the select criteria on the sc connector. And change the filenaming in the script.

    The script will also output a text file listing all the attachments for each incident written.
    Attached Files
    Best regards Tommy
    Blog - - ITIL certified - Accredited Integration Specialist – HP OpenView Service Management

    Want to keep this site alive? Consider making a donation. Click here.

  2. #2
    Senior Member eisefr's Avatar
    Join Date
    Nov 2001
    Location
    Germany
    Posts
    538

    Default

    Super cool!

    Is it deleting the record in the sysblob file too?

    That would be EXTRA-cool :-)
    Frank

    • If it happens once, it's a bug.
    • If it happens twice, it's a feature.
    • If it happens more than twice, it's a design philosophy.

  3. #3
    Administrator tommy's Avatar
    Join Date
    Nov 2001
    Location
    Copenhagen
    Posts
    4,272

    Default

    Nope its not deleting anything. It could probably do that.
    Best regards Tommy
    Blog - - ITIL certified - Accredited Integration Specialist – HP OpenView Service Management

    Want to keep this site alive? Consider making a donation. Click here.

  4. #4
    Senior Member eisefr's Avatar
    Join Date
    Nov 2001
    Location
    Germany
    Posts
    538

    Default

    I will look into that. Cause we have LOTS of attachments in our SYSBLOB - file.

    Would make that file much smaller if I could delete all attachments.

    But I just installed connect it yesterday. Don't know how to use it yet.

    Your connector is working though. Tryed it out in our test system.

    Also a simple update in a device record triggered by a incoming email worked already.

    But didn't have much time to look into do a little bit more complex things.
    Will do that next week.

    Curious. Seems to be a powerful tool!
    Frank

    • If it happens once, it's a bug.
    • If it happens twice, it's a feature.
    • If it happens more than twice, it's a design philosophy.

  5. #5
    Administrator tommy's Avatar
    Join Date
    Nov 2001
    Location
    Copenhagen
    Posts
    4,272

    Default

    Yes Connect.It is a powerfull tool. Can be a pain in the but sometimes but it can do a lot of things.
    Best regards Tommy
    Blog - - ITIL certified - Accredited Integration Specialist – HP OpenView Service Management

    Want to keep this site alive? Consider making a donation. Click here.

  6. #6
    Member
    Join Date
    Feb 2002
    Location
    Phoenix, AZ
    Posts
    34

    Default

    Tommy,
    I need to do the opposite: load from folder into SC. Do you have any info/experience on this you could share?

    Jeff

  7. #7
    Administrator tommy's Avatar
    Join Date
    Nov 2001
    Location
    Copenhagen
    Posts
    4,272

    Default

    I have not tried reading files and load them into SC.
    Best regards Tommy
    Blog - - ITIL certified - Accredited Integration Specialist – HP OpenView Service Management

    Want to keep this site alive? Consider making a donation. Click here.

  8. #8
    Member
    Join Date
    Feb 2002
    Location
    Phoenix, AZ
    Posts
    34

    Default

    Bummer, thanks.

  9. #9
    Junior Member
    Join Date
    May 2008
    Posts
    24

    Default

    Jeff,
    A web service call could do that. If, for example, you wanted to add the attachments to an Incident, you could create a small app to get the attachment and call the UpdateIncidentRequest and pass along the attachment. The .Net environment makes working with attachments fairly seamless so I would recommend that route, but I am sure Java would do the same.

    Hit me up if you need further guidance. I have some example code in C# and javascript. There is also the Example Web Services code in OOB 6.2 (it is there in 7, but I am pretty sure HP didn't update it to work with the new SM 7 web services format.).

    Happy Saturday,
    --- Travis

  10. #10
    Senior Member oscarferreira1's Avatar
    Join Date
    Nov 2007
    Location
    Portugal
    Posts
    272

    Default

    Quote Originally Posted by nobody13 View Post
    Jeff,
    A web service call could do that. If, for example, you wanted to add the attachments to an Incident, you could create a small app to get the attachment and call the UpdateIncidentRequest and pass along the attachment. The .Net environment makes working with attachments fairly seamless so I would recommend that route, but I am sure Java would do the same.

    Hit me up if you need further guidance. I have some example code in C# and javascript. There is also the Example Web Services code in OOB 6.2 (it is there in 7, but I am pretty sure HP didn't update it to work with the new SM 7 web services format.).

    Happy Saturday,
    --- Travis
    I would be interested in some sample code to view how you attach a file to the "UpdateIncidentRequest" and also how you edit the "extaccess" record.
    Thank you
    Best Regards,
    Óscar Ferreira
    Certified IT Service Management ITIL v2 & v3 (EXIN)
    Novabase

  11. #11
    Junior Member
    Join Date
    Feb 2011
    Posts
    1

    Default

    Hey guys,

    I am completely new to all things Peregrine/HP. I inherited a sunsetting system a month ago and have been charged with porting the data to SQL 2008 for archival purposes. I was able to get the data, but not the attachments...at least not viewable attachments. I have tried running this scenario, but I get the following error:

    Connector is not able to consume document type.

    It looks like I have configured the connectors correctly, but with my VERY limited knowledge of this product I could be completely wrong. Does anyone have any ideas here?

    SC 5.1.5; CIT 3.3.2

    Thanks in advance.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts