Programmatically update the List Edit Form URL

using (SPSite spCurrentSite = new SPSite("http://sp/sites/hr"))
 {
 using (SPWeb web = spCurrentSite.OpenWeb())
 {
 SPList spCurrentList = web.Lists.TryGetList("TestList");
 SPFolder currentRootFolder = spCurrentList.RootFolder;
 web.AllowUnsafeUpdates = true;
 spCurrentList.DefaultEditFormUrl = web.Url + "/" + currentRootFolder.Url + "/EditFormNew.aspx";
 spCurrentList.Update();
 web.AllowUnsafeUpdates = false;

}
 }

Leave a comment

Include/Register PowerShell SnapIN

#*************************************************************************************************************************
# *Include Powershell SnapIn *
#
#    There are 2 ways to add a snapin
#        1.  Add-PSSnapin -name "Microsoft.Sharepoint.Powershell";
#        2.  cd 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Config\PowerShell\Registration'
#			    .\SharePoint.ps1
#	         cd \
#	 Below i am check if the snapin is registered.
#          If it's not registered, It regsiters.
#          else If it's registered it will silently continue without poping an error
# *************************************************************************************************************************

if ( (Get-PSSnapin -Name "Microsoft.Sharepoint.Powershell" -ErrorAction SilentlyContinue) -eq $null )
{
    Add-PSSnapin -name "Microsoft.Sharepoint.Powershell";
}

, , , ,

Leave a comment

Get the XML of CQWP using XSL

<xsl:stylesheet 
  version="1.0" 
  exclude-result-prefixes="x d xsl msxsl cmswrt"
  xmlns:x="http://www.w3.org/2001/XMLSchema"
  xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
  xmlns:cmswrt="http://schemas.microsoft.com/WebParts/v3/Publishing/runtime"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:template name="ShowXML" match="Row[@Style='ShowXML']" mode="itemstyle">
        <xsl:for-each select="@*">
            <br />
            Name: <xsl:value-of select="name()" />
            <br />Value:<xsl:value-of select="." />
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet> 

,

Leave a comment

Hide the “Home” tab in the topnavigation of Sharepoint 2010

.s4-toplinks .s4-tn ul.root > li.static > a{display:none!important;}

Leave a comment

Adding Font to Content Editor Webpart or Rich Text Editor

Add the font file(TrueType font file (.ttf)) to “C:\Windows\Fonts” and add the belwo to the custom css for sharepoint :

.ms-rteFontFace-12{ -ms-name: "HelveticaNeueLT Com 77 BdCn"; font-family: "HelveticaNeueLT Com 77 BdCn";}

Note: .ms-rteFontFace-1 to .ms-rteFontFace-11 is used by sharepoint to define its fonts.

Leave a comment

SGEN: error: An attempt was made to load an assembly with an incorrect format

Error : Problem while compiling in release mode

An attempt was made to load an assembly with an incorrect format: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\Microsoft.Office.Server.Search.dll.

Solution :

Set “Generate Serialization Assembly” to “Off” on the project properties for the release build configuration.

Further information : http://social.msdn.microsoft.com/Forums/en-AU/netfx64bit/thread/21d14405-ca6f-4503-b416-f56bfb27168b

 

1 Comment

Customize mysite.master to look like v4.master in sharepoint 2010

To customize the mysite.master to look like v4.master, please follow the steps below :

1. Copy the master page “v4.master” and rename the “v4.master” to “mysitecustomv4.master”

2. Open the “mysitecustomv4.master” in the sharepoint designer and search for a tag "<SharePoint:DelegateControl runat="server" ControlId="GlobalNavigation"/>" and delete it from the master page.

3. OOB, the mysite master page doesn’t have the left nav.So we shall remove the left nav pannel completely from the “mysitecustomv4.master” page.
Search for the tag "<div id="s4-leftpanel" class="s4-notdlg">" and remove the whole content of that div till the closure tag of that div tag.

4. Add this

<div id="s4-leftpanel" class="s4-die">
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBarDataSource" Visible="false" runat="server" />
<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" Visible="false" runat="server" />
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBarTop" Visible="false" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" Visible="false" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderLeftActions" Visible="false" runat="server"/>
</div>

at the end of last div before "<SharePoint:DeveloperDashboard runat="server"/>"
as shown in the snap shot below

5. Add this <SharePointPortalControls:MySiteCssRegistration runat="server" Name="mysitelayout.css"/> in the <head></head> section

6. Search for the tag "<asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">" and replace the content of the contentplaceholder with this :

<div class="s4-pr ms-globalnav s4-notdlg">

<div class="ms-globalnavmenu">
	  <SharePoint:AspMenu ID="MySiteTopNavigationMenu" 
      Runat="server" 
      EnableViewState="false" 
      DataSourceID="MySiteTopNavDS" 
      AccessKey="<%$Resources:wss,navigation_accesskey%>" 
      UseSimpleRendering="true" 
      UseSeparateCss="false"
       Orientation="Horizontal" 
       StaticDisplayLevels="1" 
       MaximumDynamicDisplayLevels="0" 
       PopOutImageUrl="" 
       SkipLinkText="" 
       CssClass="s4-mysitetn"/>

			<SharePointPortalControls:MySiteDataSource 
            ShowStartingNode="False" 
            SiteMapProvider="MySiteMapProvider" 
            id="MySiteTopNavDS" 
            StartingNodeUrl = "sid:1002" 
            runat="server"/>
            </div></div>

that completes the steps of making mysite master page look like the v4.master with all the funtionality still intact

2 Comments