Search This Blog

Wednesday, May 26, 2010

Sharepoint Designer 2007 workflow error occurred on Update List Item when field type is Person/Group

Issue:
Sharepoint Designer 2007 workflow error occurred on Update List Item when field type is Person/Group
Solution:
Follow these steps to find an alternate solution:
  • Add a new workflow variable of type string.
  • Add a new workflow step at the begining of the workflow.
  • Copy the value from the people field to the variable.
  • Use the build dynamic string action to add this string to the beginning of the variable -1;# (and the original value of the variable after the string using a lookup)
  • Use the variable in the action that require the value from the people field.

Compare Dates in XSL of DataView webpart

The dates within XSL can not be compared directly. Following is the example how it can be done :

<xsl:if test="number(translate(substring-before(ddwrt:FormatDate(@Created,1053 ,5), ' '), '-', '')) = number(translate(substring-before(ddwrt:TodayIso(), 'T'), '-', ''))" >
< xsl:value-of select="@Title"/>
</xsl:if>

In this example @Created field(SharePoint List column) is compared with current date(TodayIso()).

Sunday, May 9, 2010

MOSS 2007 - Save sub site as a template

If you are trying to save a site as a template in WSS v3 or MOSS 2007 you will find that the link "Save site as template" is only available under Look and Feel at the Top Level of the site collection. Doesn't really help if you want to save a sub site as a template now does it? If you would like to save a sub site as a template you need to append _layouts/savetmpl.aspx to your sub sites url. I am guessing Microsoft just forgot this link and it will be around by the time we go RTM.

If your subsite is :

http://server/sites/site1/site11/default.aspx

You would go to

http://server/sites/site1/site11/_layouts/savetmpl.aspx

and then you would be able to save the site as a template.

Saturday, October 24, 2009

Hide Save button on Multipage Survey Page

To hide save button on mutipage survey following javascript can be used. Insert following javascript block within PlaceHolderMain after <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> line of NewForm.aspx & EditForm.aspx page of the Survey

<script type="text/javascript" >
_spBodyOnLoadFunctionNames.push('hideSave');

function hideSave()
{
var tags=document.getElementsByTagName('input');
alert(tags.length);
for(var i=1; i<tags.length; i++)
{
if(tags[i].value=='Save')
{
tags[i].style.visibility='hidden';
}
}
}
</script>

Saturday, October 10, 2009

Show PDF icon in SharePoint Library view

To show the PDF icon (or any other icon) in SharePoint Document Library view do following:
1. Find 16x16 icon file, say pdficon.gif and upload it under \12\TEMPLATE\IMAGES folder
2. Then open \12\TEMPLATE\XML\DOCICON.XML and in the "By Extension" section add the following configuration line:
< key="pdf" value="pdficon.gif">

Restart IIS and now PDF icon should appear against PDF files in any document Library.

Do the same for other file types also.

Monday, August 17, 2009

Add ..more hyperlink to Announcement Webpart


Description: I was having a request from end user to display ..more hyperlink the annoucement webpart, which redirects to respective item display page.

Solution: Create a custom XSL template for Content Query Webpart. Then use Content Query Webpart to display Announcement content using Custom XSL template. Follow these steps:

1. Open root site of web, go to View All Site Content---> Style Library -->XSL Style Sheets & locate the file ItemStyle.xsl. Open ItemStyle.xsl with any text editor & insert following template named AnnouncementStyle at the bottom before </xsl:stylesheet> tag :

<xsl:template name="AnnouncementStyle" match="Row[@Style='AnnouncementStyle']" mode="itemstyle">
<xsl:variable name="SafeLinkUrl">
<xsl:call-template name="OuterTemplate.GetSafeLink">
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="DisplayTitle">
<xsl:call-template name="OuterTemplate.GetTitle">
<xsl:with-param name="Title" select="@Title"/>
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/>
</xsl:call-template>
</xsl:variable>

<div id="linkitem" class="item">

<div class="link-item">
<NOBR><div><a href="{$SafeLinkUrl}" title="{@LinkToolTip}">
<xsl:value-of select="$DisplayTitle"/>
</a></div>
<div class="description"> By <xsl:value-of select="@Author"> </xsl:value-of> <xsl:value-of select="ddwrt:FormatDate(string(@Created), 1033, 2)"> </xsl:value-of></div></NOBR>
<div class="description">
<xsl:value-of select="substring(@Body,1,200)" disable-output-escaping="yes"/>
<a href="{$SafeLinkUrl}" title="Read more.."> ...more
</a>

</div>
</div>
</div>
</xsl:template>

2. Add a Content Query Webpart on the page where you want to display the announcement & set Query-->Source to Show items from the following list: & Select the Announcement List you want to display. Now, export the webpart to .webpart file on your PC. Open exported .webaprt file & locate the tag <property name="CommonViewFields" type="string">
replace above line with
<property name="CommonViewFields" type="string" >Body, text; Created, text;FileDirRef,text </property>

3. Now, import above modified .webpart file & add this CQW webpart to page & remove previously added CQW.
4. Modify above CQ webpart & set the Presentation-->Item Style to AnnouncementStyle.

Result: Finally CQW should display announcements like following: