Announcement

Collapse
No announcement yet.

Save all attachments from SC to local folder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

    Please do NOT send me private messages asking for help with specific topics. I do not have the time. Post your question in the forums.

    Blog - - ITIL certified - HP Accredited Integration Specialist Service Manager v9

    ServiceNow Certified System Administrator - ServiceNow Certified Implementation Specialist - ServiceNow Certified Application Developer

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

  • #2
    Super cool!

    Is it deleting the record in the sysblob file too?

    That would be EXTRA-cool :-)
    Frank

    Comment


    • #3
      Nope its not deleting anything. It could probably do that.
      Best regards Tommy

      Please do NOT send me private messages asking for help with specific topics. I do not have the time. Post your question in the forums.

      Blog - - ITIL certified - HP Accredited Integration Specialist Service Manager v9

      ServiceNow Certified System Administrator - ServiceNow Certified Implementation Specialist - ServiceNow Certified Application Developer

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

      Comment


      • #4
        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

        Comment


        • #5
          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

          Please do NOT send me private messages asking for help with specific topics. I do not have the time. Post your question in the forums.

          Blog - - ITIL certified - HP Accredited Integration Specialist Service Manager v9

          ServiceNow Certified System Administrator - ServiceNow Certified Implementation Specialist - ServiceNow Certified Application Developer

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

          Comment


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

            Jeff

            Comment


            • #7
              I have not tried reading files and load them into SC.
              Best regards Tommy

              Please do NOT send me private messages asking for help with specific topics. I do not have the time. Post your question in the forums.

              Blog - - ITIL certified - HP Accredited Integration Specialist Service Manager v9

              ServiceNow Certified System Administrator - ServiceNow Certified Implementation Specialist - ServiceNow Certified Application Developer

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

              Comment


              • #8
                Bummer, thanks.

                Comment


                • #9
                  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

                  Comment


                  • #10
                    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

                    Comment


                    • #11
                      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.

                      Comment


                      • #12
                        Hi Tommy,
                        while opening scn file getting abrupt error "Connect it has stopped working"
                        Can you please suggest a workaround for this .

                        Thanks in advance..

                        Comment


                        • #13
                          Originally posted by deepansh anand View Post
                          Hi Tommy,
                          while opening scn file getting abrupt error "Connect it has stopped working"
                          Can you please suggest a workaround for this .

                          Thanks in advance..
                          It could be compatibility issue, the script was written in a very old version of Connect.It. I have not worked with Connect.It for many years now. Today I would write a javascript to do this.
                          Best regards Tommy

                          Please do NOT send me private messages asking for help with specific topics. I do not have the time. Post your question in the forums.

                          Blog - - ITIL certified - HP Accredited Integration Specialist Service Manager v9

                          ServiceNow Certified System Administrator - ServiceNow Certified Implementation Specialist - ServiceNow Certified Application Developer

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

                          Comment

                          Working...
                          X