Wednesday, 15 October 2014

SharePoint 2010 Menu Customisation

Here is an awesome menu customisation for SharePoint 2010. I used the Css to make it look like on the screenshot, i have uploaded the Css and the image file which you can download.

This post is basically an excerpt from the blog , i am reposting it. Link

Sometimes it’s the small details that matters most and makes the difference. This post is about how to customize the look and feel for the global navigation, one important element in the SharePoint interface. The navigation control renders a fairly deep HTML structure with a lot of classes to keep in mind when you need to set your branding on the top of it. Recently I built an Intranet branding where the agency had the desire to include a small arrow for selected links in the navigation. This CSS do also take care of drop downs, in the case you are using that. I hope this could be useful for you if you need to include graphics, like this arrow in the global navigation.

Tuesday, 22 July 2014

SharePoint Scrolling Announcement/ News Scroll for 2010/2013

I been asked to create a scrolling announcement for one of my SharePoint 2010 website and  thought it was straight forward however googling for a while i realised many solution have lots of script to be done and some not working, i finally found an easier way to do the same; i have spend many hours to make this happen, by posting this hope will save some of your time.

How does this work ? This uses Content Query webpart and fetch data from Announcement list (Yes any number of announcements can be scrolled) and will display on the site, Here is a screenshot -

If you like it and would want to implement it here are the  steps -

[I have done this and tested on SharePoint 2010 and IE 11/Chrome]

Step 1.
Create an Announcement list or use the one which is already in the SharePoint list (You can create any list as you wish)

Step 2.
Add a CQWP and fetch the item to display- in my case i set a new field called "Show Scroll" and in the CQWP filtered the items if set to Yes

Step 3.

I have added a new CQWP template as in the article - editing the itemstyle.xsl. I have added "MarqueeTitleOnly" as the last template above  -

You can find that in the download code Link here -

Find the edited item.xslt where i added a new template in the end, update yours appropriately -

Step 4.

Once after set the CQWP to use the new template you created  - 

That's all, set the CQWP with appropriate width so that it shows a scroll button on the right.

Now you have a kool news ticker/Scroller webpart which picks news from Announcement list and shows it on your HomePage....

Friday, 18 July 2014

How to Import Excel Spreadsheet to Lists in SharePoint 2010 / 2013

 Users asking you they have large data in Excel and want to import it into SharePoint; You might have dealt with it at least once if you are in SharePoint.

The primary option will be to import data onto SharePoint by creating a custom list from the Spreadsheet as said on this link - MS Link; there could  be situation where the list is already present and you want to update the data or not follow this approach and then you might think about the SharePoint Datasheet view

However this approach also have several limitations as the excel sheet values should need to be of the same datatype again SharePoint Datasheet view have some restrictions on columns with "Multiline columns" as  and so on... Now what is the best way, i was trying different things and nothing much was helping me out until I found the MS Access way  :)

Yes if you have MS Access service enabled on your farm you have a better and easy way to bulk upload data onto SharePoint in easy 4 steps, Here are the steps
[I have used MS Access 2010 and SharePoint 2010, Access Service enabled on SharePoint farm]

Step 1.
Open MS Access on your client machine > Select All files > MicrosoftSharePoint foundation ()

Step 2.
Specify a SharePoint Site > Select  > Linked to the data Source by creating a linked table > Click Next

Step 3

Select the Table which you want to import data > Click OK

Step 4

Access will create a table which is linked on to SharePoint and you can easily upload, export or manage any data's and SharePoint list will be synced and updated immediately.

Hope this helps.... Happy SharePointing....

Thursday, 13 February 2014

SharePoint 2010 Content Query Web Part (CQWP) to display items from a List and Format it

In this article i will show how to query a SharePoint List using Content Query Webpart and display the results in a Nice formatted way
Here is a screenshot of what i have done using CQWP , querying a Custom SharePoint List:


I will explain the steps below on how i have accomplished this :

Step 1.
I have created a custom list with appropriate list columns and it has got columns with the names : “Contract Name” [Single Line of Text]  “Alert Date”[Date and Time] and “Notes” [Multiple line of Text].


Step 2.
Add a Content Query Webpart [CQWP] on to the site, now for displaying this in the above format we need to do two things
- Need to Edit the “ItemStyle.xslt” in the Styles folder and need to add a bit “CSS” on to the Site. Both of these can be accomplished as long as you have access to these folders and if you can add a Content Editor Webpart on to the page.
Now let me walk you through these two steps:

First lets see how we can edit the “Item Sytle.xl” file
Navigate to Site Actions > View All Site Content > Style Library > XSL Style Sheet > “Item Style.xsl” open this file in the SharePoint Designer (recommend to take a backup of that before you do anything) and then you have to add a bit code in the end to create a new template,   i have created a new one called “EventDisplay” .This will create a new style in your Content Query Web Part’s “Item Style” dropdown.  Make sure you add the code which you can find on the end of the file from code line 647, also this should be added inside the  “</xsl:stylesheet>”. The file is self explanatory, make necessary changes in accordance with your list and column names.

Make sure you add the ddwrt namespace to your .xsl file in the beginning, Do this by pasting this line near the top of the file, right below the “xmlns:cmswrt” (usually line 6)

Here i have created a completed “ItemSyle.xsl” which you can DownLoad Here

To get this new XSL style to look decent, we’ll also need to add some CSS to make it stand out. If you already have a custom stylesheet attached to your masterpage, open that up. If not just add a Content Editor Webpart to the page to add the styles[if you don’t know how to do it find  here a similar example . So with your CSS open, paste in these styles, on the Item style.xsl file there are references to these CSS classes which gives the the formatting.

You can download the code from here again DownLoad Here

/*NewList XSLT Styles*/ .xslCal .left{width:82px; position:relative; left:-21px; float:left;} .xslCal .right span{display:block;} .xslCal .month{text-transform:uppercase; background:#71cdf4; color:#fff; padding:3px 0 3px 18px; width:68px; display:block; } .xslCal .day{font-size:61px; width:86px; display:block; line-height:70px; text-align:right;} .xslCal .title{color:#0775aa; display:block; padding-top:3px;}
Now navigate to the page where you want to display CQWP, and click Site Actions->Edit Page. Then add a Content Query Web Part to the zone you want. Get into the toolpane for that web part by clicking the small black arrow in the title, and selecting “Edit Web Part”. This will open the toolpane on the right side of the screen. Fill out your query by clicking the “Show items from the following list” radio button, and using the “Browse” button, goto the “Custom” list you created earlier. Under the “Content Type” heading, select “List Content Types” from the first dropdown, then “Item” from the second.


Open up the “Presentation” tab and make sure that the Group Style is “Banded” and Item Style is “EventDisplay”. Then, to ensure that the correct data goes in the correct slots, setup the “Fields to Display” like shown.


If you got it all done correctly, you will get a nicely formatted CQWP like this, Hope this helps you with your journey with CQWP.


How to filter SharePoint List based on user permission

Have you ever had a scenario where you had to create a custom list and then you should only show items in the list which the user is supposed to see based on the user permission or the User Group he belongs to?
Read on if you want to find a solution for this scenario..... I did tried lot of researching and I got bits and pieces of information scattered in the net but couldn’t find a compete article, so thought to blog it, hope this will help you.

I will brief a bit more on the scenario:

I was asked to create a Master Custom list for users of different departments in my company however since there are confidential documents these items should not be shown to each other. My initial thought was to achieve this OOB using views and permission however while digging down I understood that this was not straight forward and I couldn’t find much help from the internet. To achieve this I have done the below : 

Step 1.

First I have created a Custom list called “Contract Manager” with the necessary columns for me to store contracts (My Company teams were supposed to store contract proposals in a List), I created a Column called “Departments” on the list which is basically a “Person or Group” field. 

Step 2.

I have created SharePoint Groups with Contribute access with the names “CTProcurement”, “CTHR” ..... (Prefixed CT as I was called this site Contract Manager, so you can create the group with any logical name and then set it to Contribute permission. So while creating a new item in the list the users will be able to add this group on to the Department field and also CAN add any department on to the field, for me there was a business case that “Procurement” team will create contract proposals for them and for other team. In this was users can create items which can be visible for other teams as well.

Step 3.

Once completing the above 2 steps you need to create a New View or edit the “View All” default view using SharePoint Designer, and what we are going to do is we will set the view in such a way that it will only display items which the user belongs to and will pick the “Group Name” which the user belong to and will filter the “Department” column to show only items with the Group Name. In- essence the users will only see the items in the list for which their department is added on the “Department” column. This is a simple logic, you might need to take a moment to contemplate.

Now here are the steps where you can put this Query in the default view/Or a new View you create : 

- Open the Site in SharePoint Designer 
- Select the List, and on the right hand side, click on the “All Items” view Once opened  Search for “ &lt;Query&gt;

- Paste the below code, analyse the code it is straight forward make appropriate changes for yours if needed

You can also download the full working view code from here - Download Code

-       Sometimes when you try to save the view it might throw you error, for me it was saying “Reference field not found”, so I have the add the “Department” reference field properly below the “ &lt;Query&gt; tag – 

Step 4 –

Once you done this and if everything is working, well done you are almost there J, Now we need to edit the permission level’s slightly so that the “Contributors” group should not create a new “View” where they can see all the items, for that follow the step below
            Site Action &gt; Permission Levels &gt; Contribute &gt; Uncheck “Manage Personal Views  -  Create, change, and delete personal views of lists” , I have also unchecked “Manage Lists  -  Create and delete lists, add or remove columns in a list, and add or remove public views of a list.”. So now the contribute users will not be having permission to create a new view where they can change the filters.

For my project this was a perfect solution, I did this in SharePoint 2010, I believe the same principle can apply in SharePoint 2013 there is also something called “Content Search Webpart” which you can make use of, now I have also created a simple reporting mechanism to display all the items for which the alert date is set by using Content Query Webpart. I will soon write about that for you….till then happy SharePointing :)… Hope this helps you.

Here is a screenshot of CQWP that –