Sunday, January 29, 2012

Add Bullet to SharePoint Quick Launch

Add the core.css classes in your Custom CSS.
Find the Following CSS and add below code.


.s4-ql ul.root ul{
list-style-type: square !important; (OR)
list-style:none inside url('/sites/cppolicy/Style%20Library/Images/img-icon-leftnav.png');
   list-style-position: outside !important;
     margin-left: 25px !important;
}

.s4-ql ul.root ul > li > a{
/* Display Bullet in Quick Launch*/
      display: inline-block !important;
     padding-bottom: 0px !important;
     padding-left: 0px !important;
     vertical-align:bottom !important;
}

Friday, January 20, 2012

SharePoint Top navigation links read from the External file.


Get data from external file for SharePoint Top Navigation:
1.      Open the Web.config file for the SharePoint web application with a text editor such as notepad.
2.      Take copy the web.config before modifying the file.
3.      Path of the web.config is “C:\inetpub\wwwroot\wss\VirtualDirectories\80\”
4.      Add the following code in the siteMap and providers  as a last row.
<siteMap defaultProvider="CurrentNavigation" enabled="true">
      <providers>
<add name="CustomNavigationProvider" siteMapFile="/_layouts/1033/styles/CustomNavigationProvider/CustomSiteMap.sitemap" type="System.Web.XmlSiteMapProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

5.      Save the Web.config and close it.
6.      Create a SiteMap file named CustomSiteMap.sitemap and put it into a new folder with the name CustomNavigationProvider. Add this folder into following directory: \14\TEMPLATE\LAYOUTS\1033\STYLES\CustomNavigationProvider

<?xml version="1.0" encoding="utf-8" ?>
<siteMap>
 
  <siteMapNode title="" url="">
    <siteMapNode title="Home" url="/"/>
    <siteMapNode title="sitecollection1" url="/sites/sitecollection1"> </siteMapNode>
   
  <siteMapNode title="Functions">
                  <siteMapNode title="sitecollection2" url=" /sites/sitecollection1 "/>
                  <siteMapNode title=" sitecollection3" url=" /sites/sitecollection3"/>
                  <siteMapNode title="ISC" url="/sites/isc"/>
                  <siteMapNode title="IT" url="/sites/it"/>
  </siteMapNode>
 </siteMapNode>
</siteMap>

7.      Open the master page and search for the content placeholder with the id PlaceHolderHorizontalNav. Replace this placeholder with this code:

<SharePoint:AspMenu
      ID="TopNavigationMenuV4"
      Runat="server"
      EnableViewState="false"
      DataSourceID="topSiteMap"
      AccessKey="<%$Resources:wss,navigation_accesskey%>"
      UseSimpleRendering="true"
      UseSeparateCss="false"
      Orientation="Horizontal"
      StaticDisplayLevels="2"
      MaximumDynamicDisplayLevels="1"
      SkipLinkText=""
      CssClass="s4-tn"
      Visible="false"/>
    <SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate"><Template_Controls>
            <asp:SiteMapDataSource
              ShowStartingNode="False"
              SiteMapProvider="SPNavigationProvider"
              id="topSiteMap"
              runat="server"
              StartingNodeUrl="sid:1002"/>
        </Template_Controls></SharePoint:DelegateControl>
       
       
        <SharePoint:AspMenu
      ID="CustomXmlNavigationAspMenu"
      Runat="server"
      EnableViewState="false"
      DataSourceID="CustomNavigationSiteMapDataSource"
      AccessKey="<%$Resources:wss,navigation_accesskey%>"
      UseSimpleRendering="true"
      UseSeparateCss="false"
      Orientation="Horizontal"
      StaticDisplayLevels="1"
      MaximumDynamicDisplayLevels="3"
      SkipLinkText=""
      CssClass="s4-tn">
   
    </SharePoint:AspMenu>

    <!-- Second sitemap DS -->
    <SharePoint:DelegateControl runat="server" ControlId="CustomXmlMapProviderDelegateControl">
        <Template_Controls>    
            <asp:SiteMapDataSource
              ShowStartingNode="False"
              SiteMapProvider="CustomNavigationProvider"
              id="CustomNavigationSiteMapDataSource"
              runat="server" />
        </Template_Controls>
    </SharePoint:DelegateControl>

8.      Save the master page now the Top navigation read the external file. If you want add new link to the top navigation add it into the CustomSiteMap.sitemap.




Friday, December 16, 2011

Converting a Custom SharePoint 2010 Master Page into a Search Center Master Page


  1. Make a copy of v4.master (or whatever other custom master page you are working with) and give it a new name like v4_searchcenter.master.
  2. Edit the new master page and locate and remove the PlaceHolderTitleBreadcrumb. This will allow the pop-out breadcrumb to still function properly:
    <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">
    <SharePoint:ListSiteMapPath
    runat="server"
    SiteMapProviders="SPSiteMapProvider,SPContentMapProvider"
    RenderCurrentNodeAsLink="false"
    PathSeparator=""
    CssClass="s4-breadcrumb"
    NodeStyle-CssClass="s4-breadcrumbNode"
    CurrentNodeStyle-CssClass="s4-breadcrumbCurrentNode"
    RootNodeStyle-CssClass="s4-breadcrumbRootNode"
    NodeImageOffsetX=0
    NodeImageOffsetY=353
    NodeImageWidth=16
    NodeImageHeight=16
    NodeImageUrl="/_layouts/images/fgimg.png"
    RTLNodeImageOffsetX=0
    RTLNodeImageOffsetY=376
    RTLNodeImageWidth=16
    RTLNodeImageHeight=16
    RTLNodeImageUrl="/_layouts/images/fgimg.png"
    HideInteriorRootNodes="true"
    SkipLinkText="" />
    </asp:ContentPlaceHolder>
  3. Next, add the PlaceHolderTitleBreadcrumb back right before the PlaceHolderMain. This will allow the search center to inject the search box in a good location:
    <asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server"></asp:ContentPlaceHolder>
    <asp:ContentPlaceHolder id="PlaceHolderMain" runat="server"/>
  4. Move PlaceHolderPageTitleInTitleArea (and any supporting HTML) to a hidden panel because this placeholder isn’t used the same way in the search center:
    <asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" />
    <asp:Panel visible="false" runat="server">
    <asp:ContentPlaceHolder id="PlaceHolderPageTitleInTitleArea" runat="server" />
    </asp:Panel>
  5. For v4.master you will also want to remove ClusteredDirectionalSeparatorArrow and <h2></h2>. It won’t make sense to show these at the top now:
    <SharePoint:ClusteredDirectionalSeparatorArrow runat="server"/>
    <h2></h2>
  6. Next, several lines of CSS need to be added to make sure things look right for the search center. You can add them to the <head> section of the master page:
    <style type="text/css">
    /* remove left margin */
    .s4-ca {
    margin-left: 0px;
    }
    /* remove gray background at top (optional) */
    .srch-sb-results {
    background:transparent none repeat scroll 0 0;
    }
    /* clean up top padding on 1st search page */
    .srch-sb-main {
    padding-top: 20px;
    }
    /* remove centering on 1st search page (optional) */
    .srch-sb-results4 {
    margin: inherit;
    padding-left: 20px;
    }
    /* remove background color on 1st search page (useful for colored designs) */
    .ms-bodyareaframe {
    background-color: transparent;
    }
    /* ------------------------------------------ */
    /* -- CSS that may be req. to reset the search styling -- */
    /* ------------------------------------------ */
    /* fix height of area above search results */
    td.ms-titleareaframe, div.ms-titleareaframe, .ms-pagetitleareaframe {
    height: auto !important;
    }
    /* fix border color on search results */
    .ms-main .ms-ptabrx, .ms-main .ms-sctabrx, .ms-main .ms-ptabcn, .ms-main .ms-sctabcn {
    border-color: #eeeeee;
    }
    /* fix arrangement of body area on search results */
    .srch-sb-results {
    height: auto;
    }
    /* fix positioning of prefs and advanced link on results */
    .ms-sblink {
    display:block;
    }
    /* fix the color of the prefs and advanced link on results */
    .ms-sblink a:link, .ms-sblink a:visited, .ms-sblink a:hover {
    color:#0072BC;
    }
    </style>
    5. Save the new master page, and check in / publish as a major version and approve it. Apply this master page to only the search center, and apply it as site master page while leaving system master page set as v4.master.
UPDATE: Some commenters have pointed out that if you want to edit pages in the Search Center (and who doesn’t?) these changes result in a double ribbon scenario. I haven’t fully tested this fix, so I’d be curious to hear about the results, but it looks like this would fix it:
  1. Add <asp:ContentPlaceHolder id="PlaceHolderGlobalNavigation" runat="server"/> to the hidden panel.
  2. Remove <div id="s4-ribboncont">…</div> and ALL of its contents.
  3. Add in its place this line: <asp:ContentPlaceHolder ID="SPNavigation" runat="server"></asp:ContentPlaceHolder>.

screenshots of the final result:



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…

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...