This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How can I extract attachments out of CM tickets?

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:

Parents
  • 0
    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 in reply to 

    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.

     

              


    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.

Reply
  • 0 in reply to 

    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.

     

              


    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.

Children
  • 0 in reply to 

    Hi,

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

    regards,

  • 0 in reply to 

    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.