Highlighted
Absent Member.. Absent Member..
Absent Member..
3642 views

How can I extract attachments out of CM tickets?

Jump to solution
I have been trying multiple ways to extract attachments our of Service Manager using Web Services (which I read many forum post many have been unsuccessful) and directly through the SQL table SYSATTACHMEM1. Pulling directly from the table seem unreadable and web services seem difficult.

Does anyone know how (if) this can be done? Ultimately, we want to send the attachment out of SM via email to a vendor for processing after the change ticket has been approved.
Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: How can I extract attachments out of CM tickets?

Jump to solution
Do you want to extract the files out of SM to a network drive before sending it in an email ?

That can be done in 2 ways.

1. Using a connect.It scenario. I built one many years ago. It needs updating but you can find it here: http://www.sc-resources.net/threads/2256-Save-all-attachments-from-SC-to-local-folder

2. Depending on the version you run you may be able to use this javascript: http://www.sc-resources.net/threads/6307-Service-Manager-9.20-How-to-export-attachments-with-javascript

View solution in original post

9 Replies
Highlighted
Outstanding Contributor.. Outstanding Contributor..
Outstanding Contributor..

Re: How can I extract attachments out of CM tickets?

Jump to solution
Do you want to extract the files out of SM to a network drive before sending it in an email ?

That can be done in 2 ways.

1. Using a connect.It scenario. I built one many years ago. It needs updating but you can find it here: http://www.sc-resources.net/threads/2256-Save-all-attachments-from-SC-to-local-folder

2. Depending on the version you run you may be able to use this javascript: http://www.sc-resources.net/threads/6307-Service-Manager-9.20-How-to-export-attachments-with-javascript

View solution in original post

Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: How can I extract attachments out of CM tickets?

Jump to solution
Your solutions offered seem very promising. Ultimately, we want to send an email with the change details and email attached. I will try this solution and get back to you with my results.
0 Likes
Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: How can I extract attachments out of CM tickets?

Jump to solution
Do you know how to create a new folder and name the folder by chance?
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How can I extract attachments out of CM tickets?

Jump to solution

Dear Lee.

Could you show me how to get binary orginal images data in Data field of SYSATTACHMEM1 table. I want to reuse this data to show on my aspx webpage. I found that there are some bit HP add to before convert to binary image data so i can not get orginal image data using ihttphandler. It notice that images content errors.

Here is my pie of code in Handler.ashx file.

 

          


@SamLee_3 wrote:
Your solutions offered seem very promising. Ultimately, we want to send an email with the change details and email attached. I will try this solution and get back to you with my results.

byte[] orginalimg = new byte[] { };
            byte[] Merger = null;            
            byte[] removebyte = HanderExten.StrToByteArray("_RCFM*=."); // i think HP add _RCFM*=. before convert to binary data and save to db
            
            while (dReader.Read())
            {
                type=dReader["MIMETYPE"].ToString().Trim();
                orginalimg = (byte[])dReader["DATA"];                
                orginalimg = orginalimg.Except(removebyte).ToArray(); // Remove addition byte data
                if(Merger==null)
                    Merger = orginalimg;
                else
                    Merger = Merger.Concat(orginalimg).ToArray(); // There are two row data of a image (merged data two rows)
            }
            context.Response.ContentType = type;            
            context.Response.BinaryWrite(Merger);

 

 

Thanks.

Highlighted
Absent Member.. Absent Member..
Absent Member..

Re: How can I extract attachments out of CM tickets?

Jump to solution

Hi,

would you mind sharing full code for your solution ? I'm looking for the exact solution.

regards,

0 Likes
Highlighted
Absent Member.
Absent Member.

Re: How can I extract attachments out of CM tickets?

Jump to solution

Hi

 

If you use SM 9.32 or later you can also develop app that connects to HP SM using RESTfull api. I have example of such applications for task module.

 

Best Regards

Highlighted
New Member..
New Member..

Re: How can I extract attachments out of CM tickets?

Jump to solution

@HuynhDt wrote:

Dear Lee.

Could you show me how to get binary orginal images data in Data field of SYSATTACHMEM1 table. I want to reuse this data to show on my aspx webpage. I found that there are some bit HP add to before convert to binary image data so i can not get orginal image data using ihttphandler. It notice that images content errors.

Here is my pie of code in Handler.ashx file.

 

 

byte[] orginalimg = new byte[] { };
            byte[] Merger = null;            
            byte[] removebyte = HanderExten.StrToByteArray("_RCFM*=."); // i think HP add _RCFM*=. before convert to binary data and save to db
            
            while (dReader.Read())
            {
                type=dReader["MIMETYPE"].ToString().Trim();
                orginalimg = (byte[])dReader["DATA"];                
                orginalimg = orginalimg.Except(removebyte).ToArray(); // Remove addition byte data
                if(Merger==null)
                    Merger = orginalimg;
                else
                    Merger = Merger.Concat(orginalimg).ToArray(); // There are two row data of a image (merged data two rows)
            }
            context.Response.ContentType = type;            
            context.Response.BinaryWrite(Merger);

 

 

Thanks.



This approach works only if the data is not compressed. If the data is compressed (COMPRESSED='t') then SM stores the data in a tricky format - basically it compresses the original file with gzip, but then overwrites the standard gzip header and footer with its own stuff, and makes it impossible to recover the original file after downloading the binary data. 

0 Likes
Highlighted
New Member.

Re: How can I extract attachments out of CM tickets?

Jump to solution

I'm unable to access these links. may I know the reason please?

 

thanks,

Sunil

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: How can I extract attachments out of CM tickets?

Jump to solution

Hello.

Tommy, unfortunately your urls does not work:

 

Invalid Page URL. If this is an error and the page should exist, please contact the system administrator and tell them how you got this message.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.