Microsoft Technology, .Net, BizTalk, Sharepoint & etc.

Liedong(Ken) Zheng, Senior SharePoint Developer at SIMPLOT

Archive for October, 2008

Get FileUpload Control Work In UpdatePanel

Posted by ken zheng on October 28, 2008

According to Microsoft the FileUpload control is not compatible with an AJAX UpdatePanel. But you use a PostBackTrigger can be added to the submit button of the form like this:

In code:
PostBackTrigger trigger = new PostBackTrigger();
trigger.ControlID = SubmitButton.ID;
updatepanel.Triggers.Add(trigger);

Posted in VS2008 | Tagged: , | 1 Comment »

Creating site template within a publishing site

Posted by ken zheng on October 27, 2008

In Publishing Site, Save as Template link is disabled under Look and Feel.
If you want to save a site template within publishing site collection you do the following:

add “/_layouts/savetmpl.aspx” behind your URL.

So you will have something like this: http://servernameStick out tongueortnumber/_layouts/savetmpl.aspx and there you will be able to save a template.

If you get error after site being created. Don’t be panic as the default page was not created without Page Layout.
The following steps show how you can edit the page.
1. Go to Manage Content and Site Structure
2. Click on the site you are having trouble with
3. Click Pages (in the tree view)
4. Ensure that at the far right, there is an associated page Layout. If your reading here, you probably have a blank layout.
5. Modify the page by hovering over the page name to get the drop down action menu
6. Click View Properties
7. Click Edit to check out the page and then change the page type. We changed ours to “Welcome Page”

Now that your page is set to welcome, we can associate a page layout.

8. Hover over the name to get the drop down action and click “Edit Page Settings”

You should now be able to assign any available page layout to your site!
9. Select “Welcome page with Web Part zones”

Posted in Sharepoint | Tagged: | 2 Comments »

Sharepoint Breadcrumb: Display’s current site title

Posted by ken zheng on October 27, 2008

To display only the current site title in Sharepoint breadcrumb add the property ParentLevelsDisplayed=”0″ in the <asp:SiteMapPath… tag

The below Asp:SiteMapPath tag display only the current site title
Example:

The below Asp:SiteMapPath tag display only the current site title parent and current site title (parent > current)

Posted in Sharepoint | Tagged: , | Leave a Comment »

Display content type in SharePoint search results

Posted by ken zheng on October 26, 2008

After reading Cherry Bites’s blog, I spend some time to understand the XSL in search result.

A full tutorial about the XSL is here.

The XSL to display content type as below
This can easily be implemented into the search results web part in MOSS

<xsl:template name="GetContentType">
    <xsl:param name="SharePointContentType"></xsl:param>
  <xsl:if test='string-length($SharePointContentType) &gt; 0'>
   -
  </xsl:if>
    <xsl:choose>
        <xsl:when test="contains($SharePointContentType,'STS_Web')">Site</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_850')">Page Library</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_850')">Page</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_DocumentLibrary')">Document Library</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_DocumentLibrary')">Document Library Items</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_Links')">Links List</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_Links')">Links List Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_Tasks')">Tasks List</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_Tasks')">Tasks List Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_Events')">Events List</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_Events')">Events List Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_Announcements')">Announcements List</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_Announcements')">Announcements List Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_Contacts')">Contacts List</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_Contacts')">Contacts List Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_DiscussionBoard')">Discussion List</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_DiscussionBoard')">Discussion List Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_IssueTracking')">Issue Tracking List</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_IssueTracking')">Issue Tracking List Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_GanttTasks')">Project Tasks List</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_GanttTasks')">Project Tasks List Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_Survey')">Survey List</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_Survey')">Survey List Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_PictureLibrary')">Picture Library</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_PictureLibrary')">Picture Library Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_WebPageLibrary')">Web Page Library</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_WebPageLibrary')">Web Page Library Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List_XMLForm')">Form Library</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem_XMLForm')">Form Library Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_ListItem')">Custom List Item</xsl:when>
        <xsl:when test="contains($SharePointContentType,'STS_List')">Custom List</xsl:when>
        <xsl:when test="contains($SharePointContentType,'urn:content-class:SPSSearchQuery')">Search Query</xsl:when>
        <xsl:when test="contains($SharePointContentType,'urn:content-class:SPSListing:News')">News Listing</xsl:when>
        <xsl:when test="contains($SharePointContentType,'urn:content-class:SPSPeople')">People</xsl:when>
        <xsl:when test="contains($SharePointContentType,'urn:content-class:SPSCategory')">Category</xsl:when>
        <xsl:when test="contains($SharePointContentType,'urn:content-class:SPSListing')">Listing</xsl:when>
        <xsl:when test="contains($SharePointContentType,'urn:content-class:SPSPersonListing')">Person Listing</xsl:when>
        <xsl:when test="contains($SharePointContentType,'urn:content-class:SPSTextListing')">Text Listing</xsl:when>
        <xsl:when test="contains($SharePointContentType,'urn:content-class:SPSSiteListing')">Site Listing</xsl:when>
        <xsl:when test="contains($SharePointContentType,'urn:content-class:SPSSiteRegistry')">Site Registry Listing</xsl:when>
        <xsl:otherwise>
            Webpage (<xsl:value-of select="$SharePointContentType"/>)
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

Then to reference this in your search results simply call this template and pass in the variable ‘contentclass’ which appears on all search result pages:

<xsl:call-template name="GetContentType">
     <xsl:with-param name="SharePointContentType" select="contentclass"/>
</xsl:call-template>

Posted in Sharepoint | Tagged: , | Leave a Comment »

Add navigation buttons to your SharePoint site

Posted by ken zheng on October 23, 2008

Janis wrote a blog to use Content Editor Web Part to create a image button. It is a very good idea so you don’t need to write any code.

Posted in Sharepoint | Tagged: | Leave a Comment »

Why use Sharepoint Best Bets

Posted by ken zheng on October 23, 2008

We’re using Best Bets to help users find information in our SharePoint system. For example, we review the search logs and identify content that users are looking for. We then create a new keyword and as many aliases as we see on the search logs for the keyword. Finally, we link up the best bets to help our users find the content they need.

For example, a common search early on was for our Travel Expense documentation. Users were searching by expenses, travel, business expenses, travel expenses, expense log, etc. We create a key word and then set the best bets to the Business Expense Log, Travel Expense Policies, etc. Our users use this query almost daily to find the information.

Here is the topic show you how to Add keyword terms with Best Bets

Posted in Sharepoint | Tagged: , | Leave a Comment »

Removing contextual: This sites cope from simple search box

Posted by ken zheng on October 23, 2008

Microsoft Office SharePoint Server 2007 provides two categories of search scopes: Custom and Contextual.

*
Custom scopes:
o
“All Sites”
o
“People”
o
The custom search scopes created via the search or site admin pages
*
Contextual scopes:
o
“This Site”
o
“This List”
Mark has posted a blog explain these 2 types.

If you want to remove the “This site” contextual scope all together, then this cannot be done using standard user interface. You need to create a new feature based on one of the existing ones. The sample below replaces the collaboration portal search box with a delegate without the “This site” contextual scopes.

1.
Make a copy the existing feature OSearchEnhancedFeature (MOSS Enterprise ed.)
2.
Change the sequence number to fit below 25, e.g.

3. Add the DropDownMode property

ShowDD_NoContextual

All you need to do now is to package the feature in solution and deploy it. You can do it manually, or use something like the WSPBuilder

Posted in Sharepoint | Tagged: | 1 Comment »

SPSolution named “SolutionPackageName” already exists under the parent Microsoft .SharePoint.Administration.SPFarm

Posted by ken zheng on October 22, 2008

If you encounter an error of type “Error 102 An object of the type Microsoft.SharePoint.Administration.SPSolution named “SolutionPackageName” already exists under the parent Microsoft.SharePoint.Administration.SPFarm named “SharePointContentDBName”. Rename your object or delete the existing object”, then even though if you remove the references of the solution in the sites, SharePoint will not allow to redeploy the solution.

The issue can be solved by, browse to the Central Administration -> Operations -> Solution Management and then delete the wsp file that caused the error and then redeploy the file again.

or run

%stsadm% -o retractsolution -name sharepointrandomimagewebpart.wsp -url “http://app01:17768/sites/infoservice” -immediate

wait a minute then run

%STSADM% -o deletesolution -name sharepointrandomimagewebpart.wsp

Posted in Sharepoint | Tagged: , | 3 Comments »

Updating daylight savings time zone information for Sharepoint

Posted by ken zheng on October 22, 2008

Please keep in mind, that if it is not updated, all items which require a date time stamp reference will be out by 1 hour.

If necessary, time zone information for Sharepoint can be manually updated, as per the following KB:
http://support.microsoft.com/kb/888253

This involves editing the timezone.xml file, located at
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\CONFIG

Example
In the following example, the end time for daylight savings is set to the first week in April, and the start time for daylight savings is set to the first week in October.
Note that the section refers to the week in the month. If this is set to 5, that means the last week.

<TimeZone ID="76" Name="(GMT+10:00) Canberra, Melbourne, Sydney" Hidden="FALSE">
        <Bias>-600</Bias>
        <StandardTime>
            <Bias>0</Bias>
            <Date>
                <Month>4</Month>
                <Day>1</Day>
                <Hour>3</Hour>
            </Date>
        </StandardTime>
        <DaylightTime>
            <Bias>-60</Bias>
            <Date>
                <Month>10</Month>
                <Day>1</Day>
                <Hour>2</Hour>
            </Date>
        </DaylightTime>
    </TimeZone>

Posted in Sharepoint | Tagged: | Leave a Comment »