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"/>

Friday, November 16, 2012

XSL for SharePoint List webparts

For out-of-the-box SharePoint List webparts, the 'XSL Link' property allows editors to customize the display of their list data.

Below is an example of an xsl stylesheet for list webparts.

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  exclude-result-prefixes="msxsl"
  xmlns:ddwrt2="urn:frontpage:internal">
<xsl:output method="html" indent="yes"/>

<xsl:template match="dsQueryResponse" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
  <div class="resourcesList" >
      <xsl:apply-templates select="/dsQueryResponse/Rows/Row"/>
  </div> 
</xsl:template>

<xsl:template match="Row">
    <xsl:if test="position()=1">
    <h2><xsl:value-of select="@Category" disable-output-escaping="yes" /></h2>
    </xsl:if>
    <a href="{substring-before(substring-after(@URL,'&gt;'),'&lt;')}">
     <xsl:value-of select="@Title" disable-output-escaping="yes" />
    </a> <br/>
</xsl:template>

</xsl:stylesheet>

Using XSLT gives a much cleaner and customized look to your list webparts.


Friday, November 9, 2012

Launch your web browser as a different user

I often need to sign into SharePoint or another local server as a different user. An easy way to do this without logging out of your computer is to use the 'runas.exe' command. open a command prompt and enter the following command:

runas.exe /u:domain\username "C:\Program Files\Internet Explorer\iexplore.exe"

substitute domain\username with your account you want to login in with, I use a test account made specifically for these situations.

Monday, November 5, 2012

RANK function to create primary key for a Remedy View Form

To create Remedy View Form, you will need a database table or view that contains a numeric primary key. Since your table or view might not have a column that fits this requirement, you may need to dynamicall y create one in the building of the view.

Use the RANK function to create an incrementing value and then cast it as a an integer:

CAST(RANK() OVER(ORDER BY TERM,CAMPUS,BUILDING,ROOM,CRS_PREFIX,CRS_NUMBER,CRS_SUFFIX) AS int) AS Record