Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Wednesday, February 10, 2016

How to retrieve user profile picture from user's My Site using SharePoint REST API

Social networking sites, personalization aesthetics and increased user interactions and expectations has changed the way website and portals are developed. 

One of the requirement often comes to SharePoint developers is to show user's profile picture on site/portal's home page or preferably in the site's header. SharePoint stores user related information in user's My Site but fetching the information from My Site and displaying it on other portal's pages could be a challenge. 

SharePoint REST API allows us to easily fetch all user profile related information and display it anywhere we want in the sharepoint portal. 

Below code snippet fetches the user's profile pic URL from user profile properties and assign it to a hyperlink tag on the page.

html to display profile pic as a background of a hyperlink.

Profile.js Javascript code to fetch profile pic url using Rest API and JQuery.

Tuesday, June 11, 2013

Create fly-out behavior for your Current Navigation menu of SharePoint 2010 Publishing Sites.

One of the first thing SharePoint branding process involves is 'Creating a 'fly-out menu'. Steps are easy and involve basic understanding of asp.net markup and css.

Step: 01 - Copy nightandday.master and rename the copied file to my_nightandday.master.

Step: 02 - Edit the my_nightandday.master and search for <SharePoint:AspMenu ID="CurrentNav".
Change the field StaticDisplayLevels to 1 and MaximumDynamicDisplayLevels to 2

Your Current Navigation control's markup should look like this

<SharePoint:AspMenu
               ID="CurrentNav"
               runat="server"
               EnableViewState="false"
               DataSourceID="SiteMapDS"
               UseSeparateCSS="true"
               UseSimpleRendering="true"
               Orientation="Vertical"
               StaticDisplayLevels="1"
               MaximumDynamicDisplayLevels="2"
               CssClass="nightanday-menu" SkipLinkText="<%$Resources:cms,masterpages_skiplinktext%>"/>


Step: 03 - Register your custom css file in your custom master page. In my case its style.css. Below is the markup to register a custom css file in master page.

<SharePoint:CssRegistration runat="server" name= "<%$SPUrl:~SiteCollection/Style Library/MY_STYLE/style.css%>" After="corev4.css"></SharePoint:CssRegistration>

Step: 04 - Place below css classes in your custom style.csss

.nightanday-menu
{
background-color: #CFD69C !important;
border-top: 1px solid green !important;
border-left: 1px solid green !important;
border-right: 1px solid green !important;
}

.menu-item
{
border-bottom: 1px solid green !important;
}

.dynamic .menu-item
{
background-color: #CFD69C !important;
border: 1px solid green !important;
font-size: 10pt !important;
color: #676767 !important;
font-weight: normal !important;
}

Step: 05 - Go to Site  Settings  > Master Page and select my_nightandday.master page to your publishing pages. Click on save.

DONE ! Your left navigation menu is now having a cool fly-out behavior.