Tuesday, March 13, 2012

SharePoint Code Samples

Microsoft has created 101 code samples for SharePoint 2010. These samples cover a wide range of useful tasks from working with lists and document libraries, to using BCS.
Check them out.
Sharepoint 2010 101 code samples

Friday, March 9, 2012

Removing author from search results

Follow these instructions to remove the author from search results.

- Navigate to the Advanced Search Page;
- Perform a search to return some search results;
- Edit the page (Site Settings | Edit Page);
- Edit the Search Core Results WebPart (Edit | Modify Shared WebPart);
- Under the Data View Properties click the XSL Editor button;
- Select all the XSL and save it somewhere to back up the default XSL;

Remove these lines and save the changes.
< xsl:call-template name="DisplayString">
<xsl:with-param name="str" select="author" />
< /xsl:call-template>

Hope this will help!                   

Thursday, March 1, 2012

Show all versions of multiline text field (Appended text)

1. Open site with SharePoint Designer and Insert a DataView WebPart(DVWP) on a page including your multiline field.
2. Switch to codeview and find the line that reference the field. (need to replace - <xsl:value-of select="@Comments" disable-output-escaping="yes" />

3. Replace with:

<SharePoint:AppendOnlyHistory runat="server" FieldName="Comments" ControlMode="Display" ItemId="{@ID}"/>

You will see the all the comments with author and dates.

To get all the versions for Multiline text field

allComments = "";
foreach (SPListItemVersion versionListItem in item.Versions)
{
        if (versionListItem["Comments"] != null){
               allComments += versionListItem["Comments"].ToString();
        }
}

CU for MOSS 2007 and WSS 3.0

Check out the New updates (Feb 2012 CU) for MOSS 2007 and WSS 3.0 

Microsoft Office SharePoint Sever 2007

Feb 2012 CU
Version:12.0.6658.5000
Link:2597958
  
WSS 3.0
Feb 2012 CU
Version:12.0.6658.5000
Link:2597959

Thursday, November 17, 2011

How to save a site as template using PowerShell

Here is Powershell script to save a site as template.

$SiteUrl = "http://Sharepoint2010/site"
$Web=Get-SPWeb $SiteUrl
$Web.SaveAsTemplate("Template Name","Template Title","Template Description",1)

The last parameter of SaveAsTemplate() can be 0 or 1. 1 if you want to save the site with data else 0.
Make sure you open the SharePoint Management Shell as Administrator.

Error - "MOSS MA not found”

Yesterday I got his error "MOSS MA not found”  while creating the connector for User Profile synchronization in SharePoint 2010.

To fix that -
I restarted the Forefront Identity Manager Service and the Forefront Identity Manager Synchronization Service.

To find those services
Run > Services.msc > Forefront Services > right click and select restart. 
If services do not start, You may need to enter service account/password on Logon Tab of service properties screen.

Hope this help!