Naming a document in Office Online

OfficeOnline

Office Online is the web based versions of the common Office application like Word, Excel and PowerPoint. These are great productivity boasters in Office365 allowing most common document editing experiences to be performed within the browser without the need to download the actual document locally.

As a user you can create a new file directly within the browser from the ‘New’ menu item shortcuts on every document library.

In OneDrive for Business it looks like this.

clip_image002[4]

In a team site it looks like this.

clip_image004[4]

Lets look at an example when we click the ‘Word document’ from the OneDrive new menu.

It opens our new document in Word Online.

clip_image006[4]

As we can see when we return to the OneDrive library our new document has been created but it has been called ‘Document1’.

clip_image008[4]

So how can we rename it to something sensible?

We can do it via the Edit Properties menu

clip_image010[4]

Change the file name in the edit form and click save.

clip_image012[4]

This now shows the file updated.

clip_image014[4]

There is an easier way.

Lets repeat the action from the new menu to get a new document. This gives us another ‘Document1′ Word document. So we should be able to switch into backstage to update the file info right…. By choosing ‘Save As’ and picking a filename.

clip_image016[4]

Well no actually this doesn’t work in Office Online as it is clever enough to be already saving directly into the online library.

clip_image018[4]

Clicking ‘Save’ tells you as much.

clip_image020[4]

So how can we change the file name? Well its actually so simple when you know how.

Click the ‘Document1′ name in the header bar while editing the document. And simply overtype your desired name.

clip_image021

When you change it you can see the change back in the main library view.

clip_image023

SP Connect 2014 Presentation

SPConnect

Tuesday 18th and Wednesday 19th saw this years SP Connect 2014 take place at the Meervaart Theatre, Amsterdam. It was a 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 the new Office 365 APIs with Chris O’Brien, the slides from our session can be seen below. I hope everyone found the session useful Smile I certainly enjoyed presenting to such an interactive audience.

Our session demonstrated the latest release of the Office 365 APIs which recently GA’d. We used the samples available on GitHub, The Web Client library used https://github.com/OfficeDev/Office-365-APIs-Starter-Project-for-ASPNETMVC the MVC5 starter example. This is a single tenancy app which uses the three elements of the Outlook Client library and the Auth models. It’s a great place to start as it shows a good spread of the API. The second demo showed the preview File Handler which shows how to extend Office 365 with a file extension capability. The pictures below give a sneak peek to how it looks when its working. The sample can be found here https://github.com/OfficeDev/GPX-FileHandler.

fullapp

SPConnectDemo

 

Thanks to everyone who attended the session, hopefully I’ll be back at next years event. Special thanks to Daniel Laskewitz for allowing me to use his session picture in this article Smile

Document conversations does not equal hover panel post

DocConv

Back in June 2014 Microsoft/Yammer announced the arrival of a new feature call ‘Document Conversations’. Available at the time of writing in some tenants (full roll out is in progress) this feature adds a fly out panel to Document Libraries in Office365. The full details of the feature can be seen on the Office Blog here: http://blogs.office.com/2014/06/03/yammer-brings-conversations-to-your-onedrive-and-sharepoint-online-files/

Our Office365 tenant is setup with ‘First Release’ which provides upcoming updates about two weeks prior to their formal rollout. Over the last month we’ve seen the Document Conversations feature coming and going. Hopefully it will be fully completed at some point very soon. During this rollout I took the time to try out the feature and get a feel of how it works.

Document Conversations in action on OneDrive for Business

Browsing to my OneDrive for Business page nothing different appears on the display. As you can see below it still looks the same as when the ‘Site Folders’ rolled out earlier this year.

image

So to invoke the ‘Document conversation’ window you have to actually browse to the document. As you can see below a new right-hand slither has appeared with the Yammer logo and an indicator to click to expand.

image

Clicking the Document Conversations bar expands it into the right-hand pane, much like the Apps for Office do in Office 365 Pro. On first use or when you’ve not signed into Yammer you will be prompted to sign in. The screen grab is once sign in has been done. First thing to note here is it isn’t displaying any threads, that’s simply because I had newly created this document for the purpose of this article.

image

Next lets create a new ‘Yam’ from the ‘Document Conversation’ pane. At this time it allows the user to select a group to post the ‘Yam’ into, interestingly there is no way to setup a default for this. I think it would be awesome if Microsoft had provided a ‘default group’ setting on the hosting Document library settings, as i suspect the feed is using the Yammer Embed which has the ability to set a default group. That way users could configure their defaults and avoid everyone posting into the ‘all company’ group.

image

After posting the ‘Yam’ it can be seen in the ‘Document Conversation’ pane. Note how its being presented as an OpenGraph object and not a url.

DocConv

Below is an example of a reply to the conversation thread.

image

This is the same conversation thread within Yammer.

image

Posting from SharePoint to Yammer

Before the ‘Document Conversation’ feature was designed and built one of the first Yammer integrations with SharePoint was the ‘Post’ option which appeared on the document hover panels. The screenshot below shows the ‘Post’ option on the same file we just used for the ‘Document Conversation’ demo.

image

Clicking ‘Post’ launches a modal window with a url in the message body so you can type a ‘Yam’. As you can see from the screenshot this is a pretty basic UI.

image

The screenshot below is the ‘Post’ in the yammer group.

image

Comparing the two approaches

So we’ve seen how both approaches seem to work. The one thing that i found puzzling was in the Yammer group i’d seen two threads about the same document. One from the ‘Document Conversation’ pane and one from the ‘Post’ modal dialog. This didn’t make sense on first glance I would have expected both to reference the same item (url) as the OpenGraph object.

Document Conversation

The ‘Document conversation’ thread has the following JSON returned from the API.

image

The body of the ‘Yam’ contained a url of the file path with query string ?web=1 which when launched opens the document in the Office Online app.

image

The OpenGraph object is detailed below. Again not the url has the ?web=1 querystring.

image

Post from hover panel

The ‘Post’ thread has the following JSON returned from the API. We can see nothing special in the thread itself.

image

The content returned by the ‘Yam’ this time shows the WOPI (Office Online) url has been used.

image

The view of the attachments xml confirms the information.

image

So doing it again

Via ‘Post’ creates a brand new post. The ‘Post’ feature adds a brand new OpenGraph object and thus starts a new thread, rather than finding the existing thread and presenting it back to the user in the popup window.

image

Conclusion

So the two methods use different urls thus become two different OpenGraph objects.

It would be great if Microsoft could bring them into alignment so that there is one solution url so all conversations appear in the same thread.

Delve YamJam summary

Delvelogo

This week people who had their Office365 tenants setup with ‘First Release’ started to see the long anticipated Delve (formally Codename Oslo) arriving on the tenants.

Microsoft organised a YamJam for Delve in the Office365 Technical Yammer network here: https://www.yammer.com/itpronetwork/#/threads/inGroup?type=in_group&feedId=4386440

This article is a summary of the information which is correct at the time of writing.

Is Delve coming to on-prem?

A hybrid approach is more appropriate due to the complexity and processing power required to drive the OfficeGraph engine. There will be APIs to allow connection to other data sources for the signals driving the OfficeGraph.

Microsoft are planning a hybrid connector that can integrate signals and content from on-premises. They have no current timeline. This is probably going to feature for the scenarios where Lync and/or Exchange have an on-premises installation.

Privacy concerns

Some users concerns around privacy topics. The example cited was that a company Delve was showing trending documents for certain HR documents for example, psychological assistance and domestic partner coverage and maternity benefits. The question was around being able to exclude certain content from producing signals.

The documents could be excluded through the normal SharePoint permissions capabilities. Delve relies on the search index, so excluding a file or folder will exclude it from Delve as well.

Currently there is no feature to exclude documents from Delve but have them available to everyone via SharePoint/Search.

Side note about storing documents from HR in Yammer and the fact that ‘viewing’ it shows up in the activity feed in the top right. This gives people visibility on what other users are looking at, so someone looking at HR docs around maternity is kind of announcing that interest to the whole organisation. Not so good.

Delve does not show ‘who’ viewed a document ever. Trending is invoked when multiple people who have a relationship with you have accessed the doc. The author is the named entity. This is slightly confusing in the UI. At a glance the name appears to be the user who viewed the document. Careful communications would need to be done for this on rollout.

Delve only shows if someone modifies a document (this is available through SharePoint anyway). Delve doesn’t show who viewed the document, where many people have viewed the document Delve says several of your colleagues have viewed this document, but never divulges the names.

‘Trending’ does not mean a person viewed it, only that your colleagues are generating activity around it. (no information on the definition of activity).

CSOM / JSOM API availability

OfficeGraph will have an API. Current information is available here: http://msdn.microsoft.com/en-us/library/office/dn783218(v=office.15).aspx

Could OfficeGraph be consumed in PowerBI?

In theory this should be possible as its got an API.

Restricting the rollout to specific users

Like an ESN Delve thrives on a wide and deep network of users. By restricting to s subset an organisation would fall into the ‘doomed social pilot’ trap of not enough signals to add the absolute value. Obviously this is an ESN success perspective. Organisations will have reasons for this request, regulation, change mangement and security were all cited.

Also it was noted that you can disable Delve at tenant level, it was unclear as to whether this is the Delve UI alone or included the OfficeGraph underpinnings.

When will I get it?

Currently this is being rolled out to ‘First Release’ tenants first.

What is the Delve UI item display limit?

Answer: 36 documents before adding filters by using search. Microsoft said 36 was chosen as the starting point through internal MS trail data. Their data showed that click rates dropped to zero at a certain point in the page.

Microsoft’s choice of name Delve

Mixed feelings, those who aren’t English speaking said that Delve doesn’t always have a real meaning in some languages. Others just preferred Oslo, and thought Delve didn’t really jump out. As with most questions like this, nothing really bad comes of the name. Lets just hope it doesn’t get a rebrand in 6 months ;)

How will Delve handle existing content and groups?

Being search based it can pick up everything in the tenant today.

Which plans get Delve?

Office365 E1-E4 and corresponding Gov and Academic plans.

At first release Delve gets signals from Exchange, OneDrive for Business, SharePoint Online and Yammer. Primary content surfaced from OneDrive for Business and SharePoint Online team sites.

What determines the people list?

This is the top five people you interact with.

Useful links

Delve documentation: https://support.office.com/Article/Who-can-see-my-documents-f5f409a2-37ed-4452-8f61-681e5e1836f3

Delve for Office365 admins here: https://support.office.com/Article/Delve-for-Office-365-admins-54f87a42-15a4-44b4-9df0-d36287d9531b

OfficeGraph API documentation http://msdn.microsoft.com/en-us/library/office/dn783218(v=office.15).aspx

Thoughts about migrating content into Yammer from forums

YammerMig

This article hopes to cover the considerations and possible approach for planning and migrating existing forum content into Yammer. Yammer doesn’t provide any form of ‘migration’ or ‘import’ for other system content. They take the stance that the working paradigms created by Yammer are unique to the platform and that managing the transition from old system to Yammer is where the investments should be made. The Yammer article here describes their high level thoughts on the subject, key for me was the statement:

2. Start fresh with content

Our customers’ experience has shown that technical migrations of content are not generally recommended, as information on Yammer tends to be more ephemeral in nature – not necessarily needed as material for future reference. There is better potential for users to be invested in and engaged with the new network if they are empowered to shape its structure and content themselves.

The realities of Client engagements tends to be slightly less black and white, where most want to consider some form of carry across information into Yammer where they have existing knowledge management forums established. Many of our clients have established forums woven into the day to day behaviours, the information within them can’t be wilted on the vine so to speak.

One key takeaway before diving into the more detailed thoughts….

Consider why you are migrating, unless its aligned to a business benefit realisation or business goal then the effort of the migration is mis-aligned to its value to the organisation. Also consider what your new operating model is, don’t migrate an old operating behaviour along with the content, you MUST migrate the content into the new behaviours and approaches you aim to have using Yammer integrated within your organisation.

Understanding the source forum information

Whatever the technology platform involved whether it is SharePoint forums or another forum technology the key element to a successful migration is auditing and understanding the content within the current forums. Key elements to understand are as follows:

  • Users
  • Forums metadata such as Title, description and logo image
  • Security model
  • Thread content
    • Styles of thread, such as single origin, multi-thread
    • Thread parenting, which forum the earliest multi-origin thread comes from
    • Mentioning users
    • Mentioning metadata
    • Attachments
    • Links
  • Value add activities like adding additional tagging or additional metadata content

From there you need to plan the content destinations in Yammer. Not always will there be a one forum to group mapping. In fact, now may be a sensible time to ‘refactor’ the approach to segregation of the conversations to something that is more relevant or easier to understand.

Users

The source system is unlikely to hold user accounts in the same fashion as Yammer. Therefore a mapping exercise is needed. Yammer users are keyed off the email address (the primary key as such).

A full listing of the users who have interacted with the forum needs to be generated. Alongside this a full extract of the Yammer users information should also be requested. In order to have all users within the Yammer Network you must establish the first date your network existed and pull the data from that date. The Yammer data export will only pull data where a user was interactive for that time period. This means you need to go a long way back for the first extract to get all the required user records. Subsequent users can be pulled in more recent extracts if you need to refresh and append data.

From this point you have the source and destination user lists. The next step is to produce a mapping between them. In general a good approach is to manipulate the records in the source user list to append the email address if possible. If you can get the source users to have a unique email address then you can map them directly against the Yammer user list.

From the mapping exercise you’ll be left with users in both lists who are not matched. Ignore the non-matches in Yammer side as they’re not really going to be a problem for migration as they have never interacted with the source forum. The non matched users in the source user list is where the focus should be placed. You have the following options:

  • Map all non-matched forum users to a generic account in Yammer. Something like Company Alumni, this has the advantage that it’s simple to map, and you can tie everything to one central user. During your Yammer rollout you can then inform the user base about the Alumni user and promote this as historic facts. The disadvantage of this approach is if there is value in knowing who made every thread post. Consider a situation where the discipline for the forum is more detailed and technical, users may still require to know who made which comment in order to trace that individual even outside of the organisation.
  • Map all non-matched forum users to newly created Yammer users. The advantage of this is that the user to thread relationship is maintained. Disadvantages is that you will have to consider how users are managed. If DIRSync is being performed this may be more complex. Also these users need to be active during migration and then suspended once the threads are added.

For the purposes of forum migration it is unlikely you need to consider the values within the user profiles and migrating those, but again this is worth discussing for your scenario.

Groups

Consider how you will be mapping in the existing forums. Do the existing forums contain threads which span wide topics? Could it be beneficial to split the existing forum into smaller segments, in which case the thread mapping to Yammer Groups needs to establish this. Also consider that the groups may not yet exist, so you might have to work out the creation and admin assignment as well. Be careful not to orphan any threads which are topics that no longer fit into the Yammer Group structure.

Also the big difference between Yammer Groups and many forum based technologies is that the Yammer Groups lack any form of hierarchy, so where a source forum may be grouping several sub sections the Yammer Groups don’t behave in this fashion. My thoughts here is that you should structure the Yammer Network to support the new working patterns you are creating. It is likely that the Yammer rollout is in support of other initiatives. So consider if the new Groups are topic/subject centric now, and how you might have to map threads into these topics. Many of the implementations we have been rolling out use a SharePoint site to aggregate the groups into a form of hierarchy or associations. This is a loose coupling though and a sensible approach, the association to hierarchy is only appropriate if the user scenario warrants it, such as a knowledge network.

Group metadata such as name, logo and description are also key for discovery by users within the Yammer Network. Consider also telling users which the primary language is for the group. Yammer has a pretty good translation mechanism using Bing Translate, but some groups naturally centre around a specific language.

Consider User membership for new Yammer Groups, do you want to add the users from the existing forums to the new Yammer Group? Sometimes this is a straight mapping one to one, sometimes if you re-jig the structure it becomes more complex. A simple algorithm is to capture all the users involved in the group threads and make sure they get added to the Group members. Again this in principal goes against what I’d normally be proposing, Users really shouldn’t be forcibly added to group it’s bad practice for good engagement and really annoys people.

Threads and Content

Threads and content form the cornerstone of the forum experience, in Yammer these map roughly to ‘Conversations’ and individual ‘Yams’. The Yammer paradigm is quite straight forward structure wise.

  • Network – The overall container for all the content
  • Groups – The segmentation of the content within the network into groupings of people who generate content
  • Conversation (aka a thread) – The conversations which are started and replied too
  • Yam (aka a message) – An individual post within the conversation thread.

Basics

Each thread message needs to be analysed for the following:

  • It’s parent message, so that it can be correctly associated into a new Yammer conversation
  • Any forum members mentioned in the content, so that the correct @mentions can be inserted into the new Yam
  • Any tagging used, so that the correct @mentions can be inserted into the new Yam (I know it sounds weird to say @ mentions again, but the user and tags are effectively the same with some meta data differences)
  • Any attachments being referenced by the message, so that the correct handling approach can be used (more about attachments in a minute)
  • Any Hrefs within the content, so that you can decide how to deal with the link (more about that in a few more lines)

Links

Handling Hrefs can take a couple of formats:

  • Keep them as is and just ensure they map into the content specification of Yammer
  • Modify the url against a mapping rule set, creating a permanent redirection to other migrated content
  • Modify the url against a mapping service, creating a permanent redirection but to something that can manage the redirection as content moves around in supporting platforms

If you go for an external link redirection service consider how long this will be in place for. Consider the overall benefits of redirection and watch the analytics tracing to ensure that users are still getting benefits from the service.

I did consider using SharePoint query rules as a way to manage redirection. Imagine that you create key threads in Yammer, you can create the links within them to point to a SharePoint site, each site can have its own query rules for content promotion. So where you’re knowledge management community also has a SharePoint site collection you can implement a local collection of search schema search query rules. If you take this approach you can effectively ‘map’ a Href into a search based url with specific terms. Then it fires across to SharePoint and the relevant promoted results would be presented.

Attachments

Dealing with attachments can take several forms:

  • Uploading the content into Yammer directly and effectively storing that content in Yammer
  • Making reference to external sources such as a web page where the content lives

Depending on your requirements may mean choosing the option most relevant almost on a message by message basis. My recommendation would be to store information outside of Yammer where it better aligns with collaboration systems such as Office365 sites, and upload directly where it makes more sense as social content. The obvious examples are a rule set which treats all Office document formats as upload to SharePoint and things such as images go into Yammer. You may also decide to treat some messages as ‘OpenGraph’ and have Yammer treat them as more like a notification than a message.

Thread sharing

Yammer allows a thread to be shared once created to another group. When sharing the thread sharer can choose to add additional text to the conversation share. Once shared the thread is effectively a new thread with its own content. So with this in mind you need to analyse the forum sharing paradigm in the current forums and decide how to map them into Yammer.

In situations where a thread appears across multiple forums. For example:

  • Original post goes into forum A, then is shared to forum B and C
  • When a user view either forum A,B or C the entire thread appears, thus capturing all the conversation once, but displaying it in multiple places

You need to consider how this maps into the Yammer sharing paradigm. I think the most sensible approach is to decide which Yammer Group the thread is most suited for, this is probably a manual decision in most cases. Once targeted for a specific group post the whole thread to that group, then share the complete thread into other groups. It might also be work retrospectively adding ‘tags’ to the thread.

Topics

Yammer has a tagging concept called ‘Topics’. Each thread can be tagged with topics to help discoverability. A user can elect to follow a specific Topic. So when migrating content analyse the content for potential topics and ensure they are tagged in the Yam with Topics. This is a value add activity and would require quite a lot of intelligence to identify topics in existing threads.

Dates

As you add new Yams to the Yammer threads you can’t influence the date stamp. So if you require date stamps to be known the only real solution is to append the information into the Yam text.

Security

Always a thorny issue, the conflicting paradigms of information security and engagement and openness working like a network.

There is definitely no right answer about how to handle security, so these thoughts are where I’d propose you started.

Yammer’s paradigm really needs Yammer Groups to remain publically visible and readable to reap the benefits from working like a network. So you need to plan how to ensure information which might have been secure remains so. Often the existing forums are restricted security wise by ‘membership’ as a way to keep a tight control of who can edit, often driven by reporting and funding concerns about membership numbers rather than true data sensitivity. For this scenario in most cases adopting the public group paradigm is fine.

Where you need a private group, say for example the Board, then using a Private group is perfectly acceptable.

You will need to audit the information in every thread for its compliance if you want to be 100% sure that you’ve not shown restricted information from the existing forums in the new Yammer Groups.

User engagement and roll out

Although not strictly migration in the technical sense don’t under estimate how you need to deal with users moving them from the old world into the new. Thinking about how to help users find threads that have moved.

One possible solution to this is to add a new reply in the existing forums which contains information about the thread location within Yammer. This helps anyone who has the old thread bookmarked come away with a smile as they can navigate to the Yammer conversation and continue the discussions. It also allows for a time of dual running where some but not all threads have made it into Yammer.

Another aspect to consider is publishing the whole process for the end user to read. Sounds little bonkers at first, why should users care or be told about the internals of an IT project. Well if you think about what Yammer has as a central pillar… it’s openness. So help users get into the correct mind set.

Yammer Technical

App Registration

The processing app must be registered within Yammer. Instructions for the App Registration process can be found in the Yammer Developer Center: https://developer.yammer.com/introduction/#gs-registerapp

Once the migration processing app is registered the Client Id and Client secret can be used by the app to make calls into the Yammer Network.

Authentication

The processing app must authenticate to Yammer in order to make calls the API. Information about the authentication process and options can be found in the Yammer Developer Center: https://developer.yammer.com/authentication/

OAuth Impersonation

To interact with the Yammer API on behalf of another user you will need to use a Verified Admin account for the processing app and have it call the relevant REST API endpoint to collect the user token for the user in question. Information about impersonation can be found in the Yammer Developer Center: https://developer.yammer.com/authentication/#a-impersonation

Users

The Yammer API allows you to retrieve, create, update and suspend (soft delete) users. Information about the exact API call format can be found here: https://developer.yammer.com/restapi/#rest-users

Rate limits

The migration processing app must have logic to throttle the calls made to Yammer as to not exceed these thresholds. It should also monitor the responses and act accordingly to retry and ensure data integrity in the event of API calls being blocked. Information about the Yammer REST API rate limits can be found on the Yammer Developer Center: https://developer.yammer.com/restapi/#rest-ratelimits

The content at the time of writing is as follows:

API calls are subject to rate limiting. Exceeding any rate limits will result in all endpoints returning a status code of 429 (Too Many Requests). Rate limits are per user per app. There are four rate limits:

Autocomplete: 10 requests in 10 seconds.

Messages: 10 requests in 30 seconds.

Notifications: 10 requests in 30 seconds.

All Other Resources: 10 requests in 10 seconds.

These limits are independent e.g. in the same 30 seconds period, you could make 10 message calls and 10 notification calls

Pre-reqs

Also useful during the process is the availability of an Enterprise Yammer network, mainly so you can get the admin functions like data export and impersonation working. The question over having a discreet ‘dev’ network came up, my personal thoughts are as follows. If you’re not ‘live’ with Yammer while doing the migration work then why not simplify the moving parts by keeping just the main Network. At the end of the day you can always try things in a private group first to write your processing code, then open it up once the code is tested. Worst case you add messages you need to delete later. This keeps costs down. If however you’re already using Yammer, then best to go for multiple Networks. Again it’s your choice, but Yammer is a service that you can’t actually customise, so your options are safer in my opinion.

NB: This information is my pre-execution thinking and hopefully after the work is complete I’ll come back and make any amendments to the information.

SharePoint Evolution Roadshow 2014 session If apps are the answer what was the solution

SP Evo Conf

Wednesday June 11th saw the SharePoint Evolution roadshow roll into Cambridge. Bringing with it the weather Smile and a collection of SharePoint experts from around the globe.

The full days agenda can be seen here: https://www.sharepointevolutionconference.com/abstracts.html#camt1

My session kicked off the days ‘Technical’ track. The session described the evolution in thinking required when you move from the traditional SharePoint full trust solution model towards the SharePoint App model. Having been working with SharePoint apps since the pre-release program of SharePoint 2013 the session aimed to share my experiences and lessons learnt around the solution design approaches. The slides from the session are below.

 

Spotted new UI elements at SPC14

This short post gathers together a few things I spotted with the various demo’s which might give us a clue of some UI changes.

SuiteBar UI

Interesting to see what I assume is a version of the SuiteBar we can expect to see later this year.

image

Notice that Projects, Tasks and Oslo have appeared. Projects probably implies Project Online which currently hides in a context menu like in the picture of my tenant SuiteBar.

image

 

Sites page

Looks like the sites page might have gained some thumbnail images and a context menu fly out. Funny how this screen grab probably highlights nicely the issue most users will face. The site logo is either the standard SP version or will be set in the branding and thus be identical. Hopefully they will use the algorithms used inside Oslo to bring through something more engaging.

image

 

How Office Graph may change the OneDrive views

Below is a grab from the Oslo session which shows how the ‘Shared with me’ might benefit from the Office Graph enhancements.

image

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 :)

Yammer SharePoint App Installation Error

YammerError

Yammer and Microsoft released a new SharePoint app available in the Office Store here: Yammer App details

This is a great first step towards better Yammer and SharePoint integration Smile

However on installing it on some sites I encountered an error:

image

If this was an on-prem installation I’m sure the ULS would be giving some huge clues as to what is up, but I was lucky enough to be using Office365 (I love the fact bugs are Microsoft’s problem to diagnose Smile). So the only way forward was to raise Service Request. So after some problem investigation with the Support guy we got to the answer.

The key reason this App fails to install is the supported locales from Microsoft. As you can see from the screenshot below, only US English is a supported locale.

image

Ok so nothing massively unusual there? Nope in SP2010 this is the only English available, but with SP2013 Microsoft finally worked out the UK uses ‘proper’ English with all it’s quirky spellings for things like ‘colour’. So with this in mind all of our tenant site collections are set to UK English as the locale, as you can see in the screenshot below.

image

So when you add the app you think everything would be fine…. oh how wrong you’d be… So the add new app pops the ‘trust’ dialog. My first comment here is that it also includes the language options, so not really only about ‘trust’ is it.

image

Second bad user experience here is that the languages selection is hidden by default. So being a typical user I didn’t read the information and clicked ‘trust it’. And that’s when the install error happens.

So what should you be doing?

image

So the killer ‘feature’ is that the ‘Trust it’ dialog is picking up the current sites default locale (in this case English UK) and installing the app with that locale. Now if you remember the Yammer App only supports English US locale, so you need to select this locale from the dropdown.

image

So now the app is installing with its supported English US locale into our English UK sites. So our users get the language they want in most of SharePoint and Yammer works in it’s supported language.

image

image

I think this is pretty bad that it defaults to install in a locale it doesn’t support and provides no feedback to the user. So this experience is littered with badly designed UX and errors which would be very easy to avoid, and thus wasting the time of both the user and MS Support. Sad smile Lets hope someone fixes this in some later releases.

Further fixes and information can be found here: http://blogs.msdn.com/b/ragnarh/archive/2013/07/02/yammer-app-for-sharepoint-amp-office-365-tips-amp-tricks.aspx

I hope this saves someone the hassle of raising a ticket for something so simple.