Wednesday, 20 June 2012

Sort Folders (Custom Order) in SharePoint Document Library

One of my friend recently asked me this question about sorting the folders (not in alphabetical order) in a document library. The sort order has to be custom and user should be able to specify the order in which folders should appear. Example sort order

Top
Middle
Bottom


In order to implement this you can create a new folder content type and add an order column to this content type. You do need to have the appropriate rights to do so.

The steps would be as follows.


  • Go to Site Actions
  • Go to Site Settings
  • Go to Site Content Types
  • Click Create New
  • Give it a name such as Folder Order
  • Select Parent Content Type from as of Folder Content Types
  • Select Folder as the Parent Content Type
  • You can create a new group or leave it in custom content types
  • Click OK
  • At the content type settings click Add from new site column
  • Create a site column called Item Order or something similar, select the type as Number
  • Click OK
  • Go to the list where you want the folders to be ordered
  • Go to the list settings
  • Go to Advanced Settings
  • Select allow management of content types
  • Select No for display new folder command on the new menu
  • Click OK
  • You should now see an area called content types, leave the document as is
  • Click Add from existing site content types
  • Select the Folder Order (or whatever you named it)
  • Click OK


That's it you can now create a folder structure with the order column and order your items as you need. 

Tuesday, 13 March 2012

PowerPivot Gallery shows Red X's for Icons

After publishing PowerPivot workbooks to the PowerPivot Gallery, the gallery shows Red X's instead of an image of the workbook.

When a .xlsx is uploaded or published to Gallery, behind the scene, a process (GetSnapshot.exe) is created that ultimately generates the snapshot image (.png file) and saves in C:\Windows\temp. Here are some of the troubleshooting steps for this scenario:

1. Make sure Excel services is rendering workbooks.

2. If you you have Internet Explorer 9 installed on your Farm servers you need to install Sql 2008 R2 SP1 for PowerPivot for SharePoint.

a. if you cannot upgrade to SP1 you can manually make the fix with the below steps.

In %Common Files%\Microsoft Shared\Web Server Extensions\14\Template\Layouts\PowerPivot you will find a file called ASRGLoader.htm.



Make a copy of the file and call it ASRGLoader.orig.htm (this is so that if you mess up anything you can revert :)

Open asrgloader.html in notepad.

Search for a function called onXLFrameLoad

Replace the line

if (ewaFrame.document.readyState == 'complete') {

with the line
if ( (ewaFrame.document.readyState == 'complete') || (ewaFrame.document.readyState == 'interactive') ) {

. A simple test to see if a getsnapshot is being spawned is to:

a. start task manager on your Web Frong End and click “show processes from all users”

b. go to the document library and go to view “all documents” and just edit properties. This should cause GetSnapshot.exe to fire and you should see it under task manager and can see the account it is running under

4. You can run GetSnapshot.exe manually and pass in parameters site, url, guid (note guid can be whatever). One caveat though is that the .info and .png file are created in the user’s local temp directory if they are logged in (as I was)…otherwise it will be saved in the c:\windows\temp. You cannot use this method to manually create/replace a thumbnail. This will only tell you if GetSnapshot failed (maybe b/c it took too long or something)

a. http://blogs.msdn.com/b/mtn/archive/2010/10/15/how-to-manually-refresh-powerpivot-gallery-thumbnails.aspX

5. Look in C:\Windows\Temp for the thumbnail (.png) and the log file .INFO; .INFO file should report success or failure messages

6. The workbook might not contain any embedded PowerPivot data. If so, a thumbnail will not be generated.

7. The workbook might contain more than one data source. If so, a thumbnail will not be generated.

. If the file is a .rdl file, then the data source must be embedded in the report and it must use the PowerPivot OLEDB provider and point to a workbook (.xlsx) that is contained in the same document library (i.e. the Gallery). If not, a thumbnail will not be generated.
9. Verify Alternate Access Mappings are setup correctly.

10. Add the PowerPivot site to the trusted intranet sites for the account running Getsnapshot.exe

11. disable loopback check. http://support.microsoft.com/kb/926642

12. remove the check box for refresh on open in the workbook connection properties

13. Open Advanced Settings for the Document library(PowerPivot Gallery).

Under Opening documents in the browser change the setting to "open in the Browser".
(This option worked for me)

Friday, 2 March 2012

There are no activities in your newsfeed: SharePoint 2010


You set up your My Sites host, and the newsfeed web part on My newsfeed is not showing any news feeds and displaying “STAY CONNECTED ! There are no activities in your newsfeed.” message

This is a common frustration out there in the SharePoint user community. I have seen lots of posts from people pulling their hair out trying to get Activities to show up.

This could be because you have not enabled the news feed for mysites. Please follow the steps below to do so.

1. Go to central admin user profile service.

2. Under My Site Settings click on Setup Mysites

3. Enable newsfeed

Enable_newsfeed_on_mysites

4. Enable Activity Feed Job

a) On the Central Administration Web site, on the Quick Launch, click Monitoring.
b)
On the Monitoring page, in the Timer Jobs section, click Review job definitions.
c)
On the Job Definitions page, in the list of timer jobs, click User Profile Service Application – Activity Feed Job.
d)
On the Edit Timer Job page, in the Recurring Schedule section, specify when you want the timer job to run, and then click Enable.

Once the job is finished Stay connected message will disappear and you should start seeing the activity feed.


Wednesday, 29 February 2012

Handy shortcut key for visual studio code navigation

Ctrl + - and the opposite Ctrl + Shift + -

Move cursor back (or forwards) to the last place it was.

No more scrolling back or PgUp/Dwn to find out where you were.


Tuesday, 14 February 2012

SPRello: A trello like interface for organizing items

An interface for organising items in SharePoint Lists - inspired by http://trello.com

sprello-screenshot1.png

A simple card/post it note like UI for displaying and organising items in SharePoint lists.



Monday, 13 February 2012

Creating Staff Directory Web part

Recently I had requirement to create a staff directory web part which intranet users can use to search for staff members in the organization. The web part displayed below use the people search to display results.


Search Results:





SCRIPT:

<script type="text/javascript" language="javascript">

//function for enter on keyboard and apostrophes in search strings
function txtWildPeopleFinder_KeyDown(e) {
if (e.keyCode == 13 || e.keyCode == 10) {
e.returnValue = false;
doWildPeopleSearch();
return false;
}
else {
return true;
}
}

function escapestr(str) {
return str.replace("'", "%22");
}

//staff search
function doWildPeopleSearch() {

var firstname = escapestr(document.all["firstname"].value);
var lastname = escapestr(document.all["lastname"].value);
var department = escapestr(document.all["department"].value);

var url = "";

if (firstname == "" && department == "" && lastname == "") {
alert ("Please enter first name, last name or department to search for a staff member.")
return;
}
// buliding url string
if (firstname != "") {
url += "FirstName%3A" + firstname;
}
if (lastname != "") {
if (url != "") url += "%20";
url += "LastName%3A" + lastname;
}
if (department != "") {
if (url != "") url += "%20";
url += "Department%3A" + department;
}

var staffSearchResultsPageUrl = "/search/Pages/peopleresults.aspx";

window.location = staffSearchResultsPageUrl + "?k=" + url;
return;
}
</script>

CSS:

<style type="text/css">
.label {
float: left;
width: 80px;
}
.staffDirectory div {
padding:5px 0px 0px 0px;
}
</style>

HTML:

<div class="staffDirectory">
<div>
Enter all or part of a name e.g. A will find all names beginning with A
</div>
<div class="label">
First Name:</div>
<div class="">
<input name="firstname" id="firstname" onkeydown="txtWildPeopleFinder_KeyDown(event)"
type="text" size="25" maxlength="55" /></div>
<div class="label">
Last Name:</div>
<div>
<input name="lastname" id="lastname" onkeydown="txtWildPeopleFinder_KeyDown(event)"
type="text" size="25" maxlength="55" /></div>
<div class="label">
Department:</div>
<div>
<input name="department" id="department" onkeydown="txtWildPeopleFinder_KeyDown(event)"
type="text" size="25" maxlength="55" />
</div>
<div>
<input type="button" value="Search" onclick="doWildPeopleSearch()"/>
</div>
</div>


Thursday, 9 February 2012

The responsive HTML5 master page for sharepoint 2010

Today I came across this blog about html5 responsive master page for sharepoint 2010 from kyle schaeffer. Handy,looks awesome and worth sharing.

“v5.master” is a simple HTML5 master page designed for SharePoint 2010. It makes good use of the amazing new features of both HTML5 and CSS3, including CSS3 media queries. The master page is extremely simplistic in nature, and is truly meant to serve as a framework for building your own SharePoint 2010 customizations.

SharePoint Gets Responsive

SharePoint has a knack for being rigid and difficult to customize. I’ve been working with responsive layouts for a while now, but the nature of SharePoint has thus far prevented me from making something that is as flexible as, say, this WordPress blog you’re reading right now. It’s easy-peasy to do this in WordPress, but SharePoint simply does too much. When you create a layout in SharePoint, you’re creating a layout that encompasses much more than just pages: you’ll have to contend with pages, web parts, lists, libraries, blogs, wikis, search, meeting workspaces, team sites, calendars, and the list goes on. With so much content to contend with, creating something that can contract to any width is a tall order to say the least.

To me, at least, the answer was simple: ignorance. I’m ignoring every part of SharePoint that I don’t care about. 90% of the sites that I create in SharePoint are publishing sites: public-facing with a focus on pages, navigation, and web parts. Now, that’s a list I can handle. The v5 master page uses a fluid layout that drops to a single column when the display size shrinks below 800 pixels in width. Check out the screens to see the flexibility in action:

Large/Desktop Displays:

Medium/Tablet Displays:

Small/Mobile Displays:

Read More