SP.RequestExecutor cross domain calls using REST gotcha

CrossDomain

Recently I was building a prototype SharePoint hosted app to add items into the Host web. The basic operation of the app is that it queries the Host web for specific list types, then allows a user to add a collection of new items to the selected list. So read and write operations.

When dealing with the Host web it is important to remember that you are then subject to ‘cross domain’ calls and the restrictions in place for them. The browser protects users from cross site scripting and specifies that the client code can only access information within the same URL domain.

Thankfully SharePoint comes with some inbuilt options for these calls. The Cross Domain library is the primary option in either JSOM or REST forms.

I’ve been leaning towards REST mainly at the moment primarily as a focus for learning so I could get used to this method of data interactions.

So the first code sample is to get the host web task lists:

NB: This is a cut down extract of the function just to highlight the core request.

var executor;

// Initialize the RequestExecutor with the app web URL.
executor = new SP.RequestExecutor(appWebUrl);

//Get all the available task lists from the host web
executor.executeAsync(
{
url:
appWebUrl +
“/_api/SP.AppContextSite(@target)/web/lists/?$filter=BaseTemplate eq 171&$select=ID,Title,ImageUrl,ItemCount,ListItemEntityTypeFullName&@target=’” + hostWebUrl + “‘”,

method: “GET”,

headers: {  “Accept”: “application/json; odata=verbose” },
success: successHandler,
error: errorHandler
}
);

Note from this sample how the host and app web urls are used within the url combined with the SP.AppContextSite. This is the key to invoking a cross domain call in REST using the SP.RequestExecutor

The second snippet of code is the one which adds the new item to the host web list:

NB: This is a cut down extract of the function just to highlight the core request.

var executor;

// Initialize the RequestExecutor with the app web URL.

executor = new SP.RequestExecutor(appWebUrl);

var url = appWebUrl +
“/_api/SP.AppContextSite(@target)/web/lists(guid’” + hostWebTaskList.Id + “‘)/items?@target=’” + hostWebUrl + “‘”;

//Metadata to update.
var item = {
“__metadata”: { “type”: hostWebTaskList.ListItemEntityTypeFullName },
“Title”: item.title,
“Priority”: item.priority,
“Status”: item.status,
“Body”: item.body,
“PercentComplete”: item.percentComplete
};

var requestBody = JSON.stringify(item);

var requestHeaders = {
“accept”: “application/json;odata=verbose”,
“X-RequestDigest”: jQuery(“#__REQUESTDIGEST”).val(),
“X-HTTP-Method”: “POST”,
“content-length”: requestBody.length,
“content-type”: “application/json;odata=verbose”,
“If-Match”: “*”
}

executor.executeAsync({
url: url,
method: “POST”,
contentType: “application/json;odata=verbose”,
headers: requestHeaders,
body: requestBody,
success: addPrimeTasksToHostTaskListSuccessHandler,
error: addPrimeTasksToHostTaskListErrorHandler
});

Ok so at this point you’re probably wondering what is the gotcha mentioned in the title. Well here it comes and it’s one of those cut and paste horror stories which costs developers all over the land huge amounts of wasted effort.

So if you take a look at the following block of code

var url = appWebUrl +
“/_api/SP.AppContextSite(@target)/web/lists(guid’” + hostWebTaskList.Id + “‘)/items?@target=’” + hostWebUrl + “‘”;

 

//TODO: find out why this works but the below fails with not actually performing the update
//$.ajax({
executor.executeAsync({
url: url,
type: “POST”,
contentType: “application/json;odata=verbose”,
headers: requestHeaders,
data: requestBody,
success: addPrimeTasksToHostTaskListSuccessHandler,
error: addPrimeTasksToHostTaskListErrorHandler
});

You’ll notice i copied over the structure of the method from a normal $.ajax call. THIS IS MY MISTAKE!!!!

As with many things the devil is in the details. By using this ajax snippet I’d introduced a bug which took nearly 4 hours to work out (very little found on the popular search engines about this). The worst part is that the call fires and comes back with a 200 success and even enters the success handler, BUT the action is not performed.

So what is the cause? Well basically there are subtle differences in signature.

  • The ajax call ‘type’ should be ‘method’ in the SP.RequestExecutor
  • The ajax call ‘data’ should be ‘body’ in the SP.RequestExecutor

So there you have it, two word typo’s which throw no errors but cause a logical failure in the code.

I hope this helps someone else avoid the pain Open-mouthed smile

Some really useful information about this capability can be read at:

Chris’ app series covers using this library in anger – http://www.sharepointnutsandbolts.com/2012/11/access-end-user-data-in-host-web-from.html

Apps for Office and SharePoint blog article discussing the inner workings and options for cross domain versus cross site collection – http://blogs.msdn.com/b/officeapps/archive/2012/11/29/solving-cross-domain-problems-in-apps-for-sharepoint.aspx

Using REST in SharePoint apps – http://msdn.microsoft.com/en-us/library/office/jj164022.aspx

One final comment, MSDN Code has this sample: http://code.msdn.microsoft.com/SharePoint-2013-Get-items-7c27024f/sourcecode?fileId=101390&pathId=1361160678 which doesn’t really demo cross domain at the time of writing as it isn’t using the code correctly against the host web in my opinion.

Awarded Microsoft MVP 2013 for SharePoint Server

620MVP_Horizontal_FullColor

Literally minutes before leaving work on 1st  October I received the following email:

MVPEmail

This left me utterly speechless, which is not something that normal happens to me. After re-reading it about ten times the news finally sank in. I’m ecstatic that Microsoft have awarded me the MVP award for my contributions to the SharePoint community.

So I wanted to share a number of thank you’s for everyone who has supported me along the way.

Most importantly my beautiful wife who has supported my many many hours chained to my PC in the office at home beavering away on CKSDev or Presentations instead of snuggling up in front of a movie on the sofa. Without her understanding and support I definitely wouldn’t have found time to make the contributions I have. Also sitting through many hours of practice presentations before my speaking events.

Matt Smith for four years ago helping me to understand how to start to become involved in the SharePoint community.

Waldek Mastykarz for his friendship, support and advice and those midnight coding adventures before releasing a new version of CKSDev. Thanks buddy :)

Chris O’Brien for his friendship, advice and putting up with some seriously deep technical conversations over the years when I’m trying to get my head around a SharePoint feature and Visual Studio API.

The CKSDev team past and present, Wouter, Matt, Waldek, Todd, Paul, Carsten and Wictor who all at some point over the last few years have advised, written some cool code and generally helped ensure CKSDev was meeting everyone’s needs.

The event organisers for SUGUK, Evolutions/Best Practices London, SPSUK and SPSNL (Steve Smith and Combined Knowledge, Brett, Tony and Nick, Mirjam and the DIWUG peeps) for providing me opportunities to present and be part of the event teams.

My employers Content and Code and especially people like David Bowman and Tim Wallis who gave me time and support to contribute to the community. Not to mention Salvo di Fazio, Tristan Watkins and Ben Athawes.

To conclude what has been quite an emotional post to write I just want to say thanks to everyone in the community and MVP community who have helped me all these years. There are too many to list, but you know who you are :)

CKSDev for Visual Studio 2012 version 1.2 Released

CKSLogo
The 1.2 version has just been released. It contains loads more features you had available in VS2010. All of the other features will be coming over the coming weeks as personal time allows. As you can imagine it’s no mean feat to port all of the existing features and support multiple SharePoint versions. The code base is also on a diet as code bloat was getting a little bit crazy as the tools evolved over the past 4 years.
 
You can find CKS: Development Tools Edition on CodePlex at http://cksdev.codeplex.com.
 
Download the extension directly within VS2012 from the extension manager or visit the Visual Studio Gallery.
We’re still looking for extension ideas so please post in the CKS Dev Discussions anything you think would make life better for SharePoint developers.
 

CKS Dev Feature highlights

Environment:
  • Copy Assembly Name – From the context menu of a SharePoint project you can now get the full assembly name copied to the clipboard.
  • Cancel adding features – Automatic cancellation of new SPIs being added to features. You can turn this off via the CKSDev settings options.
  • Find all project references – Find where a SPI/Feature is being used across the project from the project context menu.
  • Activate selected features – Setup which package features you want to auto-activate from the project context menu.
Exploration
  • No new features
Content
  • ASHX SPI template – Produces a full trust ASHX handler.
  • Basic Service Application template – Produces a full trust basic service application.
  • Banding SPI Template – Produces a full collection of SP2010 branding elements baseline items.
  • Contextual Web Part SPI template – Produces a contextual ribbon enabled web part.
  • WCF Service SPI template – Produces a full trust WCF Service endpoint.
  • Web template SPI template – Produces a SP2010 web template.
Deployment
  • Improvements to Quick Deploy – Performance improvements with a switch from calling into GACUtil.exe and returning to direct GAC API calls to improve performance. Also removal of ‘custom tokenisation’ for now until a more performant version is tested.
  • Quick deploy GAC/Bin deployment configuration – A deployment configuration which runs the pre-deployment command line, recycles the application pool, copies the assemblies to either the BIN or GAC depending on their packaging configuration, and runs the post-deployment command line.
  • Quick deploy Files deployment configuration – A deployment configuration which runs the pre-deployment command line, recycles the application pool, copies the SharePoint artefacts to the SharePoint Root, and runs the post-deployment command line.
  • Quick deploy all deployment configuration – A deployment configuration which runs the pre-deployment command line, recycles the application pool, copies the assemblies to either the BIN or GAC depending on their packaging configuration, copies the SharePoint artefacts to the SharePoint Root, and runs the post-deployment command line.
  • Upgrade deployment configuration – A deployment configuration which runs the pre-deployment command line, recycles the application pool, upgrades the previous version of the solution, and runs the post-deployment command line.
  • Attach To IIS Worker Processes Step – Which attaches the debugger to the IIS Worker process during deployment.
  • Attach To OWS Timer Process Step – Which attaches the debugger to the OWS Timer process during deployment.
  • Attach To SPUC Worker Process Step – Which attaches the debugger to the User Code process during deployment.
  • Attach To VSSPHost4 Process Step – Which attaches the debugger to the Visual Studio deployment process during deployment.
  • Copy Binaries Step – Copies the assemblies during deployment to either Bin or GAC.
  • Copy To SharePoint Root Step – Copies the files during deployment to the SharePoint Root.
  • Install App Bin Content Step – Copies the files to the App Bin folder during deployment.
  • Install Features Step – Installs the features during deployment.
  • Recreate Site Step – Recreates the deployment targeted site during deployment.
  • Restart IIS Step – Restarts IIS during deployment.
  • Restart OWS Timer Service Step – Restarts The SharePoint Timer service during deployment.
  • Upgrade Solution Step – Upgrades the solution during deployment.
  • Warm Up Site Step – Calls the site to get SharePoint to warm it up during deployment.
To see more details and the full feature list visit http://cksdev.codeplex.com/documentation.
 

Visit the CodePlex site for more information about the features and release.

Share and Enjoy and thanks for the continued support

SPSNL 2013 Presentation

SPSNL

Saturday 29th June saw the 2013 SharePoint Saturday Holland. Another great event organised with so many quality speakers and companies in attendance. It was a privilege to be invited to speak Smile

I presented a session on Apps for Office 2013 and SharePoint 2013, the slides can be seen below. I hope everyone found the session useful Smile I certainly enjoyed presenting to such an interactive audience.

I think Apps for Office is one of the coolest new features of Office and SharePoint 2013 and my session gives a really quick overview of the Apps for Office solution space. Then the hook up between SharePoint and Office that is now possible through the demo solution.

Over the next few months I’ll be publishing a dedicated series for Apps for Office so stay tuned for more soon.

Thanks to everyone who helped organise the event.

Custom SharePoint Item and Project Template gotchas for VS2012

VS2012Logo

This post is a quick brain dump of some of the challenges I’ve been working through updating CKSDev to work with Visual Studio 2012.

Item Templates

 

You can extend the SharePoint Visual Studio tooling in many different ways. One of which is by creating new Item Templates. Item templates are the code templates which appear in the ‘add new’ dialog in the solution project. Microsoft wrote several good walkthroughs http://msdn.microsoft.com/en-us/library/vstudio/ee256697(v=vs.110).aspx as an example.

In Visual Studio 2010 the SharePoint items were grouped in a basic ‘SharePoint’ category and deploying them via a VSIX package was actually dead simple. Edit the CSProj and replace this VSTemplate element with the following XML, and then save and close the file.

<VSTemplate Include="ItemTemplate.vstemplate">
<OutputSubPath>SharePoint\SharePoint14</OutputSubPath>
</VSTemplate>

The OutputSubPath element specifies additional folders in the path under which the item template is created when you build the project. The folders specified here ensure that the item template will be available only when customers open the Add New Item dialog box, expand the SharePoint node, and then choose the 2010 node.

So that worked fine in Visual Studio 2010 for SharePoint 2010. CKSDev for VS2010 had some smarts under the covers for packaging, but also followed this basic process.

So why is this an issue for Visual Studio 2012????

Well as you can see Microsoft moved the items into a new category called ‘Office/SharePoint’

image

In true Lt Gorman style (Aliens reference when the troops realise they can’t fire the pulse rifles under the reactor)

SO??, So what?

Rather then setting off a thermo-nuclear explosion this just causes a real headache for custom template VSIX packaging.

Each VSTemplate item in your solution has a property called ‘Category’, this is where you can tell VS to package that template under a specific category. Great so all you have to do is match the path in the new item dialog. Yes in theory.

The challenge comes that the VS/MSBuild bits behind the scenes understand a forward slash as a new folder. So you end up with Office with a sub folder of SharePoint. Not what you wanted. Sad smile

Ok so what next?

Well another thing to try is to match the OOTB folder path for the native MS templates. They live under “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplates\CSharp\Office SharePoint\1033”

So setting the ‘Category’ to ‘Office SharePoint’ should work right? Wrong more Crying face ensue as this time the space is encoded to %20 and the templates don’t show up at all.

This process of elimination had by this point taken well over two hours and was getting somewhat frustrating.

So as i mentioned earlier CKSDev already has a subtle difference to its packaging. This is due to it being distributed via the Visual Studio Gallery. The VS gallery has some nasty folder length checks (less that a combined 256) which mean the CKSDev templates are compacted folder and name wise to be as short as possible. The VS Gallery rules don’t understand the fact the tools couldn’t install on XP and check for the length anyway and reject if over 256.

Another example of this technique in action is here at Aaron Marten’s blog article which explains how this works.

The CKSDev packaging uses some MSBuild stuff to create an ‘I’ for item templates and ‘P’ for project templates during build. The VSIX then picks them up from there.

The assets section of the VSIX looks like this:

<Assets>
    <Asset Type="Microsoft.VisualStudio.MefComponent" Path="|CKS.Dev11;AssemblyProjectOutputGroup|" />
    <Asset Type="SharePoint.Commands.v4" Path="|CKS.Dev11;SP2010CommandProjectOutputGroup|" />
    <Asset Type="SharePoint.Commands.v5" Path="|CKS.Dev11;SP2013CommandProjectOutputGroup|" />
    <Asset Type="Microsoft.VisualStudio.VsPackage" Path="|CKS.Dev11;PkgdefProjectOutputGroup|" />
    <Asset Type="Microsoft.VisualStudio.Assembly" Path="|CKS.Dev11;AssemblyProjectOutputGroup|" />
    <Asset Type="Microsoft.VisualStudio.ProjectTemplate"
           d:Source="Project"
           d:ProjectName="CKS.Dev11"
           d:TargetPath="p"
           Path="P"
           d:VsixSubPath="P" />
    <Asset Type="Microsoft.VisualStudio.ItemTemplate"
           d:Source="Project"
           d:ProjectName="CKS.Dev11"
           d:TargetPath="I"
           Path="I"
           d:VsixSubPath="I" />
  </Assets>

So the solution was to modify the MSBuild elements for the CSProj file

<Target Name="GetVsixTemplateItems">
   <ItemGroup>
     <VSIXSourceItem Include="@(IntermediateZipItem)">
       <VSIXSubPath>I\%(IntermediateZipItem.Language)\$(ItemTemplateFolderPath)\%(IntermediateZipItem.Culture)</VSIXSubPath>
     </VSIXSourceItem>
   </ItemGroup>
   <ItemGroup>
     <VSIXSourceItem Include="@(IntermediateZipProject)">
       <VSIXSubPath>P\%(IntermediateZipProject.Language)\%(IntermediateZipProject.OutputSubPath)\%(IntermediateZipProject.Culture)</VSIXSubPath>
     </VSIXSourceItem>
   </ItemGroup>
</Target>

 

The item templates are using a variable declared with the category (aka the folder path) desired, whereas the projects are declared using the ‘Category’ in the properties window of the VSTemplate item. (this is the output sub path for those interested).

The path has to be declared in another element as it contains a space.

<PropertyGroup>
    <ItemTemplateFolderPath>Office SharePoint\CKSDev</ItemTemplateFolderPath>
  </PropertyGroup>

All that together gives the desired effect of all the CKSDev items appearing inside the right OOTB category.

image

image

Ok so now everything is sitting in the desired place. As with a lot of CKSDev coding its the little things like this which take so long. Understanding Visual Studio, MSBuild and SP API’s all in a days work Smile with tongue out

Project templates

 

So with the information above the project template settings are actually a lot easier.

Simply set your category to ‘Office\SharePoint Solutions’ As you actually want it to appear in a sub folder this time.

image

I hope this saves someone time and headaches Open-mouthed smile

SPC125 – Hybrid and Search in the Cloud – Brad Stevenson

SPCLogo

Brad Stevenson talks about creating a search experience which spans an On-Premises and Office365 SharePoint 2013 environment.

Search in the cloud

 

So what is the story about the cloud search capability?

Comparing SP2010 online to SP2013 online

 

Area

2010

2013

Crawl Freshness

1-2 hours <15 minutes

Query Latency

good better

Scale

was limited now much greater

Manageability

was limited more extensive

User Experience

ok big UX improvements

Extensibility

very little some new stuff

 

  • Crawl freshness is important for any search system as its important that a user trusts the results they are given. Part of this trust is that they are seeing the latest content within a timely window.
  • Query latency is already really quite snappy in SP2010 online. SP2013 moves to client side rendering approaches to improve this snappiness perception even further. This approach allows the server to share some of the rendering load with the client device improving performance for the end user.
  • Scale in SP2013 originates from the FAST technologies so brings those benefits to bear, making it a powerful and scalable platform solution.
  • Manageability within SP2013 allows more control over the schema, examples are the control over managed properties and result sources. A lot of the features which were part of the service application have now been brought down to the site collection and tenant administration levels.
  • User Experience is dramatically different with new capabilities such as hover panels, visual refinements etc. This helps a user to establish the relevance of a result without leaving the results page or downloading the documents.
  • Extensibility is improved without writing code with such elements such as the rendering templates replacing the complex XSL.

Search extensibility in the cloud

 

No code:

  • Managed properties
  • Result sources
  • Query rules
  • Result types
  • Display templates
  • Dictionaries (via the Term Store)

Code:

  • CSOM
  • REST

Packaging:

  • Import/Export search settings
  • SharePoint apps

You manage your ‘global search’ via the tenant admin interface. The only major piece of the service application settings you have no control over is the crawl scheduling. In a multi-tenant environment this really makes sense.

Journey to the cloud

 

Definition of the cloud?

 

  • Public cloud – Office 365, allows you to focus on just the software services.
  • Private cloud – Windows Azure, allows you to offload the OS and hardware to the cloud provider.
  • Traditional – All managed by the internal organisation

Moving to the cloud

 

What to move? (not just everything) and should it be everything including customisations and settings.

When to move it? How do you plan the move? Is it an all or nothing or staged co-existence.

How to move it? What tools are available?

The migration lifecycle

 

Early – 90% on-prem 10% cloud

Mid – 50% on-prem 50% cloud

Late – 10% on-prem 90% cloud

How hybrid search can help

 

User want to easily find content, they just want to find things they’re looking for and not have to think about understanding the systems structure. It is about getting their job done efficiently.

Users don’t care about migration. So don’t force users to track what’s being moved and when.

Realise that most users will never move EVERYTHING to the cloud.

Hybrid Search User Experience

 

Demo environment details:

  • On-Premises SP2013 crawling a mixture of SharePoint data and file shares
  • Office365 indexing all of its content
  • Firewall between

So the idea is that from within either environment the user can get results from either. They use query rules to ‘cross-pollinate’ results from the other environment as a block of results. Personally I’m not sure this is a great user experience. It gives a false impression to a user of which results are most important. So I remain to be convinced about using result blocks.

A neat thing to know is that the refinement panel operates over ALL returned results rather than just the local SharePoint items. Also the hover panels are dependant on the sources WOPI configuration.

Configuring Hybrid Search

 

Configuration steps:

  • Choose one-way or bi-directional
  • Deploy and configure pre-reqs
  • Configure search data settings
  • Configure search UI settings

If you are early on in your migration lifecycle a one-way where on-premises indexes Office365 might suit your needs. Or late on a one-way works for Office 365 to use on-premises. Mid-life is definitely bi-directional where the experience should be the same.

Environment Configuration

 

image

One-way or Bi-directional

 

Where will users go to search?

  • Just on-premises
  • Just Office365
  • Both

Hybrid pre-requisites

 

Non-SharePoint:

  • Reverse proxy and certificate authentication
  • Identity provider (ADFS or Shibboleth for Office365)
  • MSOL Tools
  • SSO with Office365
  • DirSync

SharePoint:

  • New SharePoint STS Token signing certificate
  • Configure a trust relationship between SharePoint on-premises and ACS
  • Configure secure store
  • Configure UPA

Configure Data Settings

 

Result source (equivalent to a federated location and scope in SP2010) pointing at:

  • URL of remote location
  • Secure Store (for client certificate)

Configure UI Settings

 

  • Query rule to show remote results in ‘Everything’ tab
  • Search vertical which ‘only’ displays results from remote location (Office365 or on-premises)

Search Centre On-Premises: Data Flow

 

image

Scenario One:

User logs into on-premises and issues a search query. It actually issues two queries. First is to the local on-premises index. The second is issued to Office365. The second query is issued through the CSOM endpoint within Office365. Identity mappings take place where the on-premises identity is mapped to the Office365 identity. Office365 then performs the query and issues the results response.

Search Centre in Office365: Data Flow

 

image

Scenario Two:

Basic flow is a reverse of on-premises except there is the introduction of the revers proxies at the perimiter to route the request back to the on-premises SharePoint. Identity is mapped from the Office365 user to the on-premises user.

This means that in both scenarios there is correct data security trimming.

Beyond the Basics

Design considerations

 

What did Microsoft consider when designing the Office365 service:

  • Crawl versus Query – Chosen to go the query root as the crawl infrastructure within Office365 was limiting. Also hundreds of thousands of tenants need to have a consistent performance maintained. Query helps to provide the best and most consistent user experience.
  • UI Presentation – Users felt it was really important to see all the results on the same page. They didn’t want to have to switch between different pages. (I’m not sure I agree with this UX being the most optimum, users are used to choosing the ‘type’ of data they want on Bing/Google eg. Images/Shopping etc)
  • Relevance and clicks – Search learns over time. Search watches which results are clicked for specific queries and adjusts over time.
  • Background compatibility – Should provide other MOSS and SP2010 on-premises hybrid. This was not possible due to some significant infrastructure and services which would have required significant investment in extending the previous SharePoint versions. One major element was the challenge of identity mapping.

Alternative Hybrid User Experience

 

The demonstration showed the example of a glossary. This is stored in a SharePoint list on-premises. It is very useful information, but is not something users query for all the time. From on-premises the demo pulls ‘people’ results from Office365 via a dedicated search vertical.

To get the on-premises ‘people’ page to use the Office365 profiles it is as simple as pointing the web part settings to use the remote result source. This means when the users click the people results it goes to the Office365 profile page. Question is what happens to the links to people in normal item results?

Hit highlighting works.

Question about multiple people stores. Answer was the suggested best practice is to host in just one location.

Result Click-Through: Options

 

image

For users on-premises accessing on-premises links are fine. Once the user is on the Office365 search results the results now have internal only urls. The click through doesn’t route through the reverse proxy anymore. So users must have that external access to the internal system.

One solution is to have a VPN or Direct Access or leveraging the reverse proxy for url re-writing.

Microsoft recommend using VPN or Direct Access as it is easier to maintain over time.

The WOPI previews are operating where-ever the content is being served from.

CKSDev for Visual Studio 2012 version 1.0 Released

CKSLogo

Since 2009 CKSDev has been available to SharePoint 2010 developers to aid the creation of SharePoint solutions. The project extended the Visual Studio 2010 SharePoint project system with advanced templates and tools. Using these extensions you were able to find relevant information from your SharePoint environments without leaving Visual Studio. You experienced greater productivity while developing SharePoint components and had greater deployment capabilities on your local SharePoint installation.

The Visual Studio 2012 release of the MS SharePoint tooling supports both SharePoint 2010 and 2013. Our aim for CKSDev was to follow this approach and provide one tool to support both SharePoint versions from within Visual Studio 2012.

The VS2012 version has just been released. It contains the core quick deployment and server explorer features you had available in VS2010. All of the other features will be coming over the coming weeks as personal time allows. As you can imagine it’s no mean feat to port all of the existing features and support multiple SharePoint versions. The code base is also on a diet as code bloat was getting a little bit crazy as the tools evolved over the past 4 years.

You can find CKS: Development Tools Edition on CodePlex at http://cksdev.codeplex.com.

Download the extension directly within VS2012 from the extension manager or visit the Visual Studio Gallery.

We’re still looking for extension ideas so please post in the CKS Dev Discussions anything you think would make life better for SharePoint developers.

CKS Dev Feature highlights

Environment:
  • Copy assembly name so no more need to use reflector to get the full strong name.
Exploration
  • New Server Explorer nodes to list feature dependancies, site columns, web part gallery, style library, theme gallery.
  • Enhanced import functionality for web parts, content types, themes.
  • Create page layout from content type (publishing).
  • Copy Id.
Content
  • Coming Soon…
Deployment
  • Quick deploy to copy artefacts into the SharePoint root without the need for a build.
  • Deployment steps Coming Soon..

To see more details and the full feature list visit http://cksdev.codeplex.com/documentation.

Visit the CodePlex site for more information about the features and release.

Share and Enjoy and thanks for the continued support

SharePoint Evolution Conference 2013

SPEvo13

SPEvo13

For five years running Combined Knowledge have hosted the conference and this years looks to be the best yet.

So why should you attend this conference?

For me the key reasons would be:

  • It will provide you with access to the best SharePoint experts from around the globe
  • You can learn about the latest version of SharePoint 2013 and its key features and applications across the different tracks
  • Meeting up with friends from across the SharePoint community
  • Listen to real-life implementations from the community track speakers
  • You get all the sessions on the DVD
  • The party is always amazing Smile

So if you haven’t already done so make sure you register soon to be in with a shout at one of the many prizes up for grabs. Register here

Speaker_Evo-2013-Banner

I’m lucky enough to be speaking at this years SharePoint Evolution Conference 2013 in London between the 15th and 17th of April 2013.

Bringing SharePoint information into Office through Office Apps

Audience: Developers

Office 2013 introduces new Apps for Office which allows developers to create apps which interact with Word, Excel and Outlook. Using an App for Office we can bring information from within the enterprises SharePoint platform and help users create documents and bring increased value form their SharePoint data. The session will explore some scenarios to bring SharePoint into the Office clients.

My Session is on from 9:45am – 10:45am on the Monday in the Pick and Mix track.

Hopefully I’ll see you there Smile

SPSUK Bring SharePoint into your Office with Apps for Office

SPSUK2012

Saturday 8th December saw the 2012 SharePoint Saturday at Nottingham’s Conference Centre. Another great event organised with so many quality speakers and companies in attendance.

I presented a session on Apps for Office 2013 and SharePoint 2013, the slides can be seen below. I hope everyone found the session useful Smile I certainly enjoyed presenting to such an interactive audience.

I think Apps for Office is one of the coolest new features of Office and SharePoint 2013 and my session gives a really quick overview of the Apps for Office solution space. Then the hook up between SharePoint and Office that is now possible through the demo solution.

Over the next few months I’ll be publishing a dedicated series for Apps for Office so stay tuned for more soon.

The code for the demo solution is available here.

The code is far from production ready and is used at your own risk.

SPC147 – Mastering app for Office Development – Ali Powell

SPCLogo

Ali provides a walkthrough of Apps for Office. Look at the type of shape and see some examples. Explanations of the API framework.

Mastering Apps for Office Development

Looking at various aspects that need consideration during development and design.

Trends impacting the apps we develop

Devices – increasing numbers projections of 350m smartphones in the workplace by 2016

People – 82% of world’s online population using social networking

Cloud – 50% of enterprises on the ‘road to’ cloud

Office is the most installed apps outside of anything in browser

New apps, New scenarios, New User Experiences

Devices – Fast and fluid with touch, pen, mouse and keyboard. Immersive experience (Win8). Support for different OS

Cloud – Office on demand, roaming and up to date. New cloud app dev model. Enterprise grade reliability and standards.

Social – Newsfeeds and micro blogging, extend with yammer. Pervasive social across Office. Multiparty HD video and Skype federation.

Office Mobile across platforms

The apps should work across all devices

Consumers typically have multiple devices

Apps are everywhere

They are becoming the primary way we deliver functionality to end users.

This is changing the paradigm about how we design and develop functionality. Old world apps were often composite applications which had a lot of breadth. They would have multiple tabs, screens and literally hundreds of different bits of functionality in one app.

Apps really give you the ability to give you transacted solutions which essential guide a user from start to finish for a specific task.

With this shift to much more targeted usage, our app lifecycles are vastly reduced as they need to deleiver less functionality and more targeted use cases.

It should reduce the need for 18-36 months projects before something is delivered.

A new paradigm for Solutions

Personas > (have) > Objectives > (and use) > Devices > (to consume) > Solutions > (composed of) > Services > (running on) > Infrastructure

Really now if you look at the flow above the solutions we are building are tied to personas. Those personas have the responsibility to meet some objective within your solution. They use devices and these devices consume the solutions we build. Most solutions will be consuming some kind of services, they often compose multiple services together into an app. This accelerates solution development by making better use of things already internally provide or from the marketplaces. All these services run on infrastructure, and the trend is to find infrastructure which is flexible and scalable.

Note: Tie an app solution to a specific end user persona to make them a success.

Apps for Office

Loosely coupled services with simpler contracts that enable developers access to more best of breed services in private and public clouds.

HTML5 and CSS3 are rapidly becoming the UX code paradigm.

Support the standardised identity model that spans computing devices.

End user focused, contextual, web based and discoverable.

Bring the web into Office.

What are apps for Office?

  1. Document-based manifest driven applications
  2. HTML5, CSS3, JavaScript
  3. Web applications hosted by any http delivery mechanism

Note: Apps for Office do not replace VSTO, they just give a different ability to deliver extensions.

Apps for Office Shapes

Task pane

Content

Mail

App for Office Framework

App for Office

Web Extensions Framework (wef)

Office JSOM

Application specific JSON (Outlook JSON, etc)

App API’s (third party api’s)

Rich clients / Web Browsers

App Manifest

Demo of the standard manifest.

Important bits of information from the manifest

  1. app type – which defines which shape this app is
  2. Id – is the unique Guid identifier which tells Office what your app is. This binds the app to the document or mailbox item its associated with. This Id is also the service point for upgrading the apps in the future.
  3. Version – the version of this app
  4. ProviderName – The name of the organisation who built the app
  5. DefaultLocale – The language for the default. This MUST be set if you want Office store validation to pass
  6. DisplayName – The name of the app
  7. Description – The description of the app
  8. AppDomains – ??
  9. Capabilities – Allows you to specifiy which set of functionality it depends upon within the host
  10. Default Settings
    1. SourceLocation – VERY IMPORTANT as it tells the Office Runtime which url it should load when the app loads within Office
  11. Permissions – The collection of permissions this document requires to be granted to run its functionality

Office stores the catalog information

In registry: Computer\HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Wef\Developer key can have a string key set for the manifest of the demo app

This helps during development without a catalogue location

App for Office Manifest

There are four pieces of information when building an app for Office are covered:

  1. Consumption Declaration – Means you need to make sure the capabilities your app depends upon, and that you have identified the type of app you want deployed. You can’t change the shape of an app once its been associated with an app.
  2. Capability Consumption – Defining which Office capabilities the app needs/
  3. Service Consumption – Identify the services your app needs to consume. Assert the client endpoints the app is going to consume. This is part of the ‘AppDomain’ definitions.
  4. Aesthetic Design – Make this an important piece, two things to make your app is installed. Make sure the first this is that the icon is a really good one. Then also consider how it sits alongside the Office branding.

Demo

Looking at an excel app for election tracker

Inside the OpenXML the app is referenced but not embedded

Open the ‘xl’ folder

Open the ‘webextensions’ folder

Open the webextensions.xml file

The xml contains some interesting nodes.

WebExtension Id – is the unique ID of that app

Reference

  • StoreType, OMEX is the public store, Registry would be a developer app, insternal would be internal app

Bindings – Shows the apps bindings to the content

Another interesting fact is that the last state of the app visually gets stored as an image in the document should the app not be available. This occurs when a save of the document is made.

Note: It would be interesting to see what the behaviour is around Versioning and Co-Auth in SharePoint hosted docs for this.

Open the ‘_rels’ folder

Open the webextensions.xml.rels file

This file binds the app instance and the image together within the document

Note: nothing is being installed to the local machine

Demo of this Excel app within the WOPI client which was pretty neat.

App For Office User Experience

App for Office execution is different on Client and WOPI.

Think this info was a little bit to deep and possibly to hardcore.

Apps are isolated, secure and performance boxed

Web client basically runs in an iFrame sandbox

Target capabilities by discovering your host – these become key to design. The developer should have intimate knowledge of what the target Office client can provide. So if it has been targeted to say Excel and Word that if a user opens it in Project that it detects this and gracefully exits.

Avoid the common pitfalls – JS Alerts are not fired. Apps for Office have governors in outlook which prevent you impacting the performance of Outlook.

Resource awareness – You don’t have all the resources from the host machine. The governors limit this. These will close the app if you breach the thresholds. In Outlook apps you can use REGEX but these have fixed time and CPUs before they are taken offline.

Crossing AppDomains – Sometimes this is needed, use AppDomains to tell the web extensions framework you will be doing this. If you don’t the resource will load in a new browser window, which isn’t probably what you want.

Resource sharing leverage Oauth – Make this default auth model. Identity is the responsibility of your app to require, acquire and maintain.

Give your app some style – Make it easy to follow, look nice and be creative.

Demo

Outlook VOIP Mail app

Demo’d the rules for a mailbox item

Apps for Office Scenarios

SharePoint Centric – Deployed as part of your SharePoint app as document templates so that they light up when you use that document

  • Business Process – Start a workflow from the document
  • Team Collaboration – As the user moves around the document supplementary information is brought back from SharePoint.
  • Workflow

Document Centric –

  • Data visualisation / Analysis & Mashups
  • Reference Tools
  • Contextual Content & Services
  • Content Authoring
  • Dashboards

Key Takeawys

Apps > (require) > Capabilities > (that target) > Hosts

One app can run across multiple clients and the cloud.

Mailbox centric apps for email and appointment features.

Task pane and Content apps for document centric apps.

More Information

JavaScript API for Office

http://bit.ly/UV2POY

Resource Usage Settings

http://bit.ly/116C8dy

Apps for Office XML Manifest

http://bit.ly/SomibV

Apps for Office Training

http://bit.ly/N76ZOC

Apps for Office Samples

http://bit.ly/V4zf87

Summary

Useful overview session. The different niche information to other Apps for Office sessions made this one worth seeing.