Wednesday, November 28, 2012

SharePoint 2013 REST Library

As part of his TypeScript presentation at SharePoint Conference 2012, Rob Bogue had to do a lot of work with the new REST API's for SharePoint 2013 (as we all did).   Not happy to simply sling a bunch of JavaScript and call it a day, Rob took things a step further and created a reference library implementation to make things a bit easier on all of us.

Wiring up a REST query from a provider-hosted app to SharePoint 2013 looks like this if you set up the call and handle results manually:

var executor = new SP.RequestExecutor(appWebUrl);
var reqUrl = appWebUrl + "/_api/SP.AppContextSite(@target)/web/lists/getbytitle('" + myList + "')/items?$select=Title&@target='" + hostWebUrl + "'";
executor.executeAsync({
 url: reqUrl,
 method: "GET",
 headers: { "Accept": "application/json;odata=verbose" },
 success: function (result) {
  var objData = $.parseJSON(result.body);
  response($.map(objData.d.results, function (item) {
   return {
    label: item.Title
   }
  }));
 },
 error: function (result, code, message) {
  alert(message);
 }
});


Using SP REST, the syntax is much cleaner and easier to read (and if you're using TypeScript you also get full Intellisense support):

obj.list.GetItemsByQuery([
{
   field: 'Title',
   operator: 'eq',
   value: obj.myValue
}]).done(function (items) { //Do Something Here });

Rob is releasing SP REST to the community and is asking for contributors to help take the project forward.  If you're interested, contact Rob via his blog and jump on the SP REST bandwagon.


Articles

Ten Steps to Optimize SharePoint Performance

Webcasts

Secrets of SharePoint Part 5: Configuring Microsoft Office SharePoint Server 2007 for Optimal Performance
Creating End User SharePoint Solutions for Performance and Scalability 
SharePoint 2010 Performance Enhancements for Administrators
Microsoft SharePoint Server 2010 for the ASP.NET Developer
Following Best Practices and Avoiding Common Errors with Microsoft Office SharePoint Server 2007 Development
SharePoint Performance and Capacity Planning Essentials
Troubleshooting Common Performance Problems in SharePoint 2010

Videos

Channel 9 Interview with Eric Shupps
SharePoint TechTalk - Different Views on Social Computing
SharePoint Post-Deployment Planning and Management

Podcasts

SharePoint Pod Show - Design for Performance
SharePoint Pod Show - Test Driven Development
Run As Radio - Eric Shupps Improves SharePoint Performance

Saturday, November 24, 2012

Creating Permalinks for SharePoint Blog Posts

Most commercial blogging platforms use a fixed URL structure, known as a "permalink", to identify posts – something like "http://www.myblog.com/2012/09/13/This-Is-My-Post.html". This structure makes it easy to reference a particular post, supports trackbacks/pingbacks, and makes it simple for search crawlers to locate content. Unfortunately, the SharePoint 2010 Blog template has no concept of how an actual blog platform should work – permalinks are an entirely foreign concept. Because SharePoint stores blog posts as individual list items, the URL structure is comprised of a fixed root path with a query string parameter for the item ID, such as "http://www.binarywave.com/blogs/eshupps/Lists/Posts/Post.aspx?ID=270". Awful stuff.

Short of writing an HTTP Handler to construct friendly URL's, SharePointers are stuck with this less-than-optimal format. That being said, it would be helpful if the various views for the Posts list in a blog actually used this link structure to refer to each item but, alas, they don't; instead, they use and even worse path identifier that references an application page in the _layouts directory with parameters for the list and item ID (i.e. "http://www.myblog.com/_layouts/listform.aspx?PageType=4&ListId={89CBE813-99F7-4257-A23A-5FEFC377336B}&ID=269"). This is the equivalent of not only forgetting to put bullets in your gun but leaving the gun behind at the saloon on your way to the OK Corral – in other words, it makes an already bad situation even worse...


Read more from Eric Shupps

Saturday, November 03, 2012

Hiding Toolbars in the SharePoint 2010 Chart Web Part

SharePoint Server 2010 ships with a nifty Chart web part that displays visual data from a number of sources – SharePoint lists, BDC, Excel services, etc. It's a handy control and one that was sorely missing from the 2007 version. It provides a number of chart options, including pies, lines, bars, cones, scatters, etc. in both 2D and 3D. Neat…but (and there's always a 'but')…it has one very annoying characteristic that drives site administrators crazy. When you drop it onto the page, it displays a toolbar with links for "Data & Appearance" and "Advanced Properties" to everyone with more than basic read permissions.

We certainly don't want everyone to see that – too much temptation to click on those links and blow up our pretty little graphs. Well, ok, should be easy enough to turn that off, right? Wrong.

Somebody, somewhere, forget to include the ubiquitous hide toolbar switch that's on most other out of the box web parts. While trying to figure out a workaround for this nice little undocumented feature, I came across a lot of links to this blog post by Nick Grattan in which he suggests editing the page in SharePoint Designer and changing the web part properties manually in the markup. That's all well and good but anyone who has ever heard me speak at a conference knows that I am not exactly the world's biggest fan of using SPD to edit pages (that may be understating it a bit, sort of like saying the Pope is a little bit Catholic or Texas gets a bit warm in the summertime). So what to do...

Read more from Eric Shupps


Articles

Ten Steps to Optimize SharePoint Performance

Webcasts

Secrets of SharePoint Part 5: Configuring Microsoft Office SharePoint Server 2007 for Optimal Performance
Creating End User SharePoint Solutions for Performance and Scalability 
SharePoint 2010 Performance Enhancements for Administrators
Microsoft SharePoint Server 2010 for the ASP.NET Developer
Following Best Practices and Avoiding Common Errors with Microsoft Office SharePoint Server 2007 Development
SharePoint Performance and Capacity Planning Essentials
Troubleshooting Common Performance Problems in SharePoint 2010

Videos

Channel 9 Interview with Eric Shupps
SharePoint TechTalk - Different Views on Social Computing
SharePoint Post-Deployment Planning and Management

Podcasts

SharePoint Pod Show - Design for Performance
SharePoint Pod Show - Test Driven Development
Run As Radio - Eric Shupps Improves SharePoint Performance

Social

ConferenceHound
Talk TechNet
Channel 9
Planet SharePoint
Lanyrd
MVP Profile
About.me
Tumblr
Speakerfile
Facebook
LinkedIn
Google+
Twitter