Wednesday, November 30, 2011

Hide List Column Headers / Titles In List Web Parts


There are several methods available.
Below you can see the list with the list column headers showing.
Hide List Column Headers - Column Headers Showing

Add CSS, Javascript Or JQuery To The Page Using A Content Editor Web Part

1: Add a Content Editor Web Part (CEWP) to the page.
Hide List Column Headers - Add CEWP
Move it below the list view web part, otherwise the Javascript and JQuery won’t work, and also your list will loose the ribbon.
The code will be added to this web part.
Remember that view pages are still just web part pages, and you can edit the page.
2: Click in the web part, and in the ribbon click HTML and then Edit HTML Source.
Hide List Column Headers - Edit HTML Source
3: Add either the CSS, Javascript or JQuery snippets as seen below, depending on your preferences.
Since a Content Editor Web Part (CEWP) is added to the page, you will loose the view selection drop down using all 3 methods.

Hide List Column Headers With CSS

Add the following text to the Content Editor Web Part (CEWP).
<style>
tr.ms-viewheadertr {
display: none
}
</style>

This will work fine if it’s a view page, but in case you have added several list views to a page, then this will hide the headers of all lists.
In case you want to just hide a specific list you will have to use Javascript or JQuery. You can’t just use IDs since SharePoint has a tendency to reuse them even though that is a big no no.
With Javascript and JQuery you can iterate through the tables and find the table whose summary attribute contains the title of the list.
In the snippets below the name of the list is Hide Column Headers.

Hide List Column Headers Of A Specific List Using Javascript

The correct list table is found by first getting all table elements, and then iterate through them, and find the one(s) with the name Hide Column Headers, which is indicated by the summary attribute. The first row in the table contains the headers, so we will just hide that one.

<script>
var tables = document.getElementsByTagName("table") 
var i;
var rows;
for (i=0;i<tables.length;i++) 
{
if (tables(i).summary == "Hide Column Headers")  
{
rows = tables(i).getElementsByTagName("tr")
rows(0).style.display = "none" 
} 
}
</script>

When using this trick, you are iterating through actual HTML content, so you have to place the content editor web part after the list view web part.
Otherwise the generated html won’t be available. Same thing with JQuery.

Hide List Column Headers Of A Specific List Using JQuery

Using JQuery is definitely also an option and can be seen below. The result is the same.
It will find all tables with an attribute called summary whose value is “List Title” and then it will hide the first (0 based index) table row.
In SharePoint the first table row will always contain the header.

<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("table[summary='Hide Column Headers'] tr:eq(0)").hide()
});
</script>

4: Edit the view, and uncheck Allow individual item checkboxes in the tabular view section, if you don’t want the pesky checkboxes to appear.
Save the page and reload it and you should see the result.
Hide List Column Headers - Hidden Columns

Hide List Column Headers With SharePoint Designer 2010

1: Go to list settings and click on the Edit List in SharePoint Designer button.
Hide List Column Headers - Edit Page With SPD
2: Once SPD opens up, click the view you wish to change.
Hide List Column Headers - SPD Views
3: Right-click in any of the column header cells.
Hide List Column Headers - SPD Find Column Header
4: Click Delete -> Delete Rows.
Hide List Column Headers - SPD Celete Column Headers
5: Click the save button.
Please remember that this will customize (unghost) your page, so if you can live with the missing view selector,



Wednesday, November 9, 2011

Move .wsp files from one server to another server farm

1.Copy the .wsp file from old server Visual studio project debug folder .
2.Paste the .wsp into the new sever (like "C:\backup\file.wsp").
3.Open the "SharePoint 2010 Management shell" Run as Administrator mode.
4.Use the following code.

    Deploy Event Receiver and Master page as farm solutions
     Add-SPSolution -LiteralPath "C:\backup\file.wsp"
      Install-SPSolution -Identity file.wsp –GACDeployment


    Deploy Visual Webpart:
    Add-SPSolution -LiteralPath "C:\backup\file.wsp"
     Install-SPSolution -Identity file.wsp -WebApplication http://serverurl –GACDeployment

  Deploy Sandbox solutions. 
Add-SPUserSolution -LiteralPath  C:\backup\file.wsp  -Site  http://serverurl /sites/name
Install-SPUserSolution -Identity  file.wsp  -Site http://serverurl /sites/name
 
 Note:http://serverurl ----> http://servername ex:(http://Sharepoint)

Sunday, November 6, 2011

Enable Quick Launch in Webpart Pages in SharePoint 2010

By default, the left navigation will be taken out in all webpart pages in SharePoint 2010. To enable this follow the below steps.
1. Open the site in SharePoint designer 2010.
2. Open the library, where you have stored the webpart page.
3. Righ click on the file and select "Edit file in Advanced Mode".

 
4. Find for the below two tags and delete them.
5.Find the below tag. Delete/comment the same.

Monday, September 5, 2011

SharePoint 2010 and Adobe PDF

The following post is an update from the original ‘SharePoint 2007 and Adobe PDF‘ post written in 2007. These notes are based on SharePoint 2010 Beta 2 (made publicly available in November 2009). Once the product has officially launched on 12 May 2010, an update will be posted if any changes are made to the process. The process is very similar to SharePoint 2007, with minor changes to folder location (14 instead of 12) and a slightly different administration user interface in the browser.
SharePoint 2010 and Adobe PDF
SharePoint Server 2010, like its predecessors, includes indexing and search capabilities. But what doesn’t come out of the box is the ability to index and search for PDF documents. PDF is a format owned by Adobe, not Microsoft. If you want to be able to find Adobe PDF documents, or have the PDF icon appear when viewing PDF files in a SharePoint document library (see image above), you will need to set it up for yourself. This post describes how to.
  1. Download and install Adobe’s 64-bit PDF iFilter*1http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025
  2. Download the Adobe PDF icon (select Small 17 x 17) – http://www.adobe.com/misc/linking.html
    1. Give the icon a name or accept the default: ‘pdficon_small.gif’
    2. Save the icon (or copy to) C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES
  3. Edit the DOCICON.XML file to include the PDF icon
    1. In Windows Explorer, navigate to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\XML
    2. Edit the DOCICON.XML file (I open it in NotePad, you can also use the built-in XML Editor)
    3. Ignore the section <ByProgID> and scroll down to the <ByExtension> section of the file
    4. Within the <ByExtension> section, insert <Mapping Key=”pdf” Value=”pdficon_small.gif” /> attribute. The easiest way is to copy an existing one – I usually just copy the line that starts <Mapping Key=”png”… and replace the parameters for Key and Value (see image below)
    5. Save and close the file
      SharePoint 2010 and Adobe PDF DOCICON.XML
  4. Add PDF to the list of supported file types within SharePoint
    1. In the web browser, open SharePoint Central Administration
    2. Under Application Management, click on Manage service applications
    3. Scroll down the list of service apps and click on Search Service Application
    4. Within the Search Administration dashboard, in the sidebar on the left, click File Types
    5. Click ‘New File Type’ and enter PDF in the File extension box. Click OK
    6. Scroll down the list of file types and check that PDF is now listed and displaying the pdf icon.
    7. Close the web browser
  5. Stop and restart Internet Information Server (IIS)*2 Note: this will temporarily take SharePoint offline. Open a command line (Start – Run – enter ‘cmd’) and type ‘iisreset’
  6. Perform a full crawl of your index. Note: An incremental crawl is not sufficient when you have added a new file type. SharePoint only indexes file names with the extensions listed under File Types and ignores everything else. When you add a new file type, you then have to perform a full crawl to forcibly identify all files with the now relevant file extension.
That’s it. If you now perform a search, PDF files should be displayed in results where they match the search query, along with the PDF icon on display in results. The icon should also be visible in any document libraries that contain PDF files.
* Additional Notes:
  1. At time of writing (March 2010), Adobe has published PDF iFilter 9 for 64-bit applications, tested on SharePoint 2007 but not yet listed as tested on SharePoint 2010. So far, it is working fine on my builds of SharePoint 2010 (Beta versions)
  2. When setting this up, I initially just restarted the search service rather than IIS but found myself locked out of SharePoint. Resetting IIS fixed it. I don’t know for certain if you also need to restart the search service. Will test on the next build and update here.
  3. As with SharePoint 2007, there are alternative PDF ifilters. The most well known is Foxit Pro – http://www.foxitsoftware.com/. Rumoured to perform indexing faster than using Adobe’s iFilter. I can’t comment, I haven’t tested it. Given PDFs don’t change (they are usually PDFs specifically to not be edited) they are only indexed when first uploaded or when you perform a full crawl. Most organisations should primarily be performing incremental crawls – updating the index with content that has been added or changed rather than re-indexing everything
  4. An absolute cheat for getting round the need to do registry edits is to install Adobe Reader on your server…
  5. There’s a Powershell script for doing all of this, see Johan Skoglund’s blog – Use Powershell to configure PDF search in SharePoint 2010. Haven’t tried it yet, will give it a go on the next demo build and it’s been confirmed int he comments
  6. Another suggestion from the comments – you don’t have to use the default icons (but do make sure whatever ones you do use are licensed or free to use).  Thanks to Jon for suggesting http://www.iconmaker.com where you can search for icons free to use commercially.  Nothing stopping you from using your own icons for all the different file types…

Wednesday, August 10, 2011

Add Breadcrumb Navigation In SharePoint 2010

Breadcrumb Navigation look like this
1. Code under the Top navigation div or below this syntax
<div id="s4-statusbarcontainer"><div id="pageStatusBar" class="s4-status-s1"></div></div>
 
Put this Master Page:
<div class="SolidBreadCrumb">
	<asp:SiteMapPath	runat="server"
		SiteMapProviders="SPSiteMapProvider,SPXmlContentMapProvider"
		RenderCurrentNodeAsLink="false"
		NodeStyle-CssClass="SolidBreadCrumb"
		CurrentNodeStyle-CssClass="SolidBreadCrumbCurrent"
		RootNodeStyle-CssClass="SolidBreadCrumbRoot"
		HideInteriorRootNodes="true"
		SkipLinkText=""/>
</div>

2. And CSS:
/* Breadcrumb styles */
.SolidBreadCrumb
{
    font-family: Arial, Segoe UI, Verdana, sans-serif; 
    color: #003F50;
    clear:both;
    font-size:9pt; 
    padding-left:7px;
    padding-bottom:2px;
    padding-top:4px;
    border-bottom:1px #003F50 solid;
    margin-bottom:4px;
}
.SolidBreadCrumb a, .SolidBreadCrumb:active, .SolidBreadCrumb a:active
{
	padding-left:0px;
	padding-right: 0px;
	text-decoration:none;
   	color: #003F50;
}
.SolidBreadCrumb a:hover
{
	text-decoration:underline;
}
.SolidBreadCrumbCurrent
{
	font-weight:bold; 
}

Monday, August 8, 2011

Add subsite into the master page Top link bar.

 Set the MaximumDynamicDisplayLevels="3".
Example:
<SharePoint:AspMenu
      ID="TopNavigationMenuV4"
      Runat="server"
      EnableViewState="false"
      DataSourceID="topSiteMap"
      AccessKey="<%$Resources:wss,navigation_accesskey%>"
      UseSimpleRendering="true"
      UseSeparateCss="false"
      Orientation="Horizontal"
      StaticDisplayLevels="2"
      MaximumDynamicDisplayLevels="3"
      SkipLinkText=""
      CssClass="s4-tn"/>
   

Redirect page into the subsite based on the URL string

Inside the Master page Head Tag enter the following Java script.
<script type="text/javascript">
   
var str="http://" + window.location.toString().split("//")[1].split("/")[0] + "/";


if(str=="http://servername/" || str=="http://servernamewithdomain/")
window.location.href = "http://servername:Port/sites/subsitename/SitePages/Home.aspx";


</script>





Give Read Permission for SharePoint Add-in for Azure AD Send Mail to Office 365 Domain Group users.

Below are the Steps for Send Mail to Office 365 Domain Group or AD Group users from Provider Hosted ADD-IN. For this we needs to Give Permi...