A link straight to a SharePoint document’s metadata

81

Often users want a link direct to a document’s metadata. That’s easily done using this format:
ht tp://SharePoint/sites/SiteCol/DemoMajorV2/forms/DispForm.aspx?ID=[x]

Here’s a sample link to a document’s metadata properties, just add the ID:
ht tp://SharePoint/sites/SiteCol/DemoMajorV2/forms/DispForm.aspx?ID=285

I took a random document:
h ttp://SharePoint/sites/SiteCol/DemoMajorV2/TestDoc.docx

Found its ID in the browser by adding it to a View:
ht tp://SharePoint/sites/SiteCol/DemoMajorV2/Forms/My%20Documents.aspx

Then took the format:
ht tp://SharePoint/sites/SiteCol/DemoMajorV2/forms/DispForm.aspx?ID=[x] and added the number to it:

ht tp://SharePoint/sites/SiteCol/DemoMajorV2/forms/DispForm.aspx?ID=285

That same format can be used within the search XSL to add a reference to view the document’s metadata in search results. Here’s the XSL to paste into the XSL field in Core Search Results:

<div class=”srch-Title3″>
 <xsl:variable name=”itemid” select=”ItemID”/>
 <xsl:choose>
 <xsl:when test=”contentclass[. = 'STS_ListItem_DocumentLibrary']“>
 <xsl:choose>
 <xsl:when test=”contains(basic4,’http’)”>
 <xsl:variable name=”library” select=”substring-after(substring-after(url,basic4),’/')” />
 <xsl:variable name=”displayUrl” select=”concat(basic4, ‘/’, substring-before($library,’/'),’/Forms/DispForm.aspx?ID=’,itemid)” />
 <a href=”{$displayUrl}”>
 Show properties
 </a>
 </xsl:when>
 <xsl:otherwise>
 <xsl:variable name=”DocLib” select=”substring-after(substring-after(url,sitename),’/')” />
 <xsl:variable name=”MetaDataPath” select=”concat(sitename, ‘/’, substring-before($DocLib,’/'),’Forms/DispForm.aspx?ID=’,itemid)” />
 <a href=”{$MetaDataPath}”>
 Show properties
 </a>
 </xsl:otherwise>
 
</xsl:choose>
 <a href=”{sitename}”>
 Show library
 </a>
 <br></br>
 </xsl:when>
 <xsl:otherwise>
 </xsl:otherwise>
 </xsl:choose>
 </div>

Share this entry

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents

Categories

Categories