Tuesday, November 27, 2012

Show attachment from Remedy in .NET web app

We have a BMC Remedy form that contains classroom information along with jpg or gif attachments. To pull these images from the Remedy form into a .NET web application, use the following code:


            byte[] content = null;
            server.GetEntryBLOB("AssetRooms", id, 536880917, out content);
           
            string base64String = Convert.ToBase64String(content, 0, content.Length);

            if (base64String.Equals(""))
            {
                Label1.Text = "<br/><br/> Map not available.";
                Image1.Visible = false;
            }
            else
            {
                Image1.ImageUrl = "data:image/png;base64," + base64String;
                Image1.Visible = true;
            }

Image1 is an Image control:

<asp:Image ID="Image1" runat="server" Height = "380"/>

No comments:

Post a Comment