In a very limited way…OneDrive for business comes to Mac-world

At long last Microsoft has released a preview of One Drive for Business for the Mac.   I have clients and partner companies who have held off from using SharePoint more widely due to the fact that One Drive was not available across all their laptop and desktop devices.

In the beta you can only sync to your SharePoint MySite…the door starts to swing a little open and then slams as you get your foot in the door! 

OneDrive for Business comes to Mac and iOS devices

Today’s post was written by Reuben Krippner director on the Office 365 team.

Today we’re excited to announce new ways that you can access and manage your OneDrive for Business files from your Mac and iOS devices.

In the last few months we’ve rolled out new mobile experiences across Android and Windows Phone, which allow people to connect to both their personal and business OneDrive storage from a single app. We’re excited to announce that today we released an updated OneDrive app for iOS that provides access to personal and work storage. This release rounds out the first phase of our mobile investments that deliver a single OneDrive experience across work and life.



Javascript error: a=b[c.toString()] in SP.js

This was a bit of an abstract error I was getting today.  The actual exception was “a=b[c.toString()]    Unable to get property ‘toString’ of undefined or null reference”

I was very difficult to track down and it was actually only when I coincidentally changed a function on one of my controls that I realised what the error actually was.  When I changed the function it was to add a confirmation message, however the confirmation started occurring on a completely different action!

Why?  Well because I was daft enough to have two functions (different web parts) with the same name on the same page.  Renamed one of the and hey what do you know – no more errors!

SharePoint Config Database – SUSPECT

After a crashed VM I got the error “The farm is unavailable” Trying to get to Central Admin I got “Cannot connect to configuration database”.  When I looked in SQL Manager the Config DB was marked as suspect.  I ran the following commands:

SELECT state_desc FROM master.sys.databases WHERE name = ‘SharePoint_Config’
SELECT state_desc FROM master.sys.databases WHERE name = ‘SharePoint_Config’

Back in business!

Linking related content to actual items rather than properties pages

A nasty side effect of using the MultipleLookupField to link to related content in your page layout has the unwelcome effect that users clicking the link are taken to the properties page for the related pages rather than the page itself.  In fact, as ludicrous as it sounds I don’t think there’s a facility to allow users to select related pages and have the selections link directly to the page.

Technically the reason is obvious enough, Microsoft wanted to make the controls that are used as generic as possible and that means they have to work at the item level.  After all who is to say that the related content is a page or even a file in a document library.  It could indeed be a contact in a contact list and if this were the case it would not have a direct URL to link to like a page or a document has.

Scouring the net for solutions didn’t turn up anything useful at all, except for the rather worrying – “it can’t be done” comments and a few who’d tried but either failed or not posted their solution.

So, I got to figuring this out for a client of mine and thought I’d share the code.  Essentially this client links policies, procedures and work instructions.  Each of these are stored as content types within a single pages library.  That makes it relatively easy to deal with.  At this stage in my thinking I had two options, a custom control or client script.  My client is on Office 365 so I immediately preferred the script option.

The following script finds links that need replacing and then used the CSOM to lookup the item and replaces the original hyperlink with a direct link.  You’d need to change the list guid I’m checking for and the two $(‘a’) loops are a bit of a hack to get around async timing issues so I’d be really interested for anyone to suggest enhancements!

<script type=”text/javascript” src=””></script>

    <script type=”text/javascript”>
        var currentItem;
        function rewriteURLs() {
            $(document).ready(function () {
                $(‘a’).each(function () {
                    var hyperlink = this.href;
                    if (hyperlink != null && hyperlink.indexOf(“PageType=4&ListId={0F82B804-A1F4-46AE-8708-58822DB2DC89}”) > -1) {
        function rewriteStart(hyperlink) {
            var vars = [], hash;
            var q = hyperlink.split(‘?’)[1];
            if (q != undefined) {
                q = q.split(‘&’);
                for (var i = 0; i < q.length; i++) {
                    hash = q[i].split(‘=’);
                    vars[hash[0]] = hash[1];
                var ctx = SP.ClientContext.get_current();
                var currentItem = ctx.get_web().get_lists().getById(vars[“ListId”]).getItemById(vars[“ID”]);
                ctx.executeQueryAsync(function () { getSPItem(hyperlink, currentItem); }, this.onFail);
        function getSPItem(hyperlink, currentItem) {
            var ctx = SP.ClientContext.get_current();
            var pageFile = currentItem.get_file();
            ctx.executeQueryAsync(function () { setLink(hyperlink, currentItem); }, this.onFail);

        function setLink(hyperlink, currentItem) {
            $(‘a’).each(function () {
                if (this.innerText == currentItem.get_item(“Title”)) {
                    this.href = currentItem.get_file().get_serverRelativeUrl();

        function onFail(sender, args) {
            alert(‘failed to get list. Error:’ + args.get_message());

        ExecuteOrDelayUntilScriptLoaded(rewriteURLs, “sp.js”);


Get your SharePoint product key

I recently needed to get a client SharePoint 2010 product key (about 3 minutes ago).  Finding some reusable code I was able to get it but it was popped up as an alert that couldn’t be copied from so I changed the code a little to output to the console.  The code is included below, save it as a .vbs file and then run it like:


CScript sharepointlicense.vbs

Here’s the code:

const HKEY_LOCAL_MACHINE = &H80000002 
strKeyPath = “SOFTWARE\Microsoft\Office\14.0\Registration\{90140000-110D-0000-1000-0000000FF1CE}”
strValueName = “DigitalProductId”
strComputer = “.”
dim iValues()
Set oReg=GetObject(“winmgmts:{impersonationLevel=impersonate}!\\” & _ 
      strComputer & “\root\default:StdRegProv”)
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,iValues
Dim arrDPID
arrDPID = Array()
For i = 808 to 822
ReDim Preserve arrDPID( UBound(arrDPID) + 1 )
arrDPID( UBound(arrDPID) ) = iValues(i)

Dim arrChars
arrChars = Array(“B”,”C”,”D”,”F”,”G”,”H”,”J”,”K”,”M”,”P”,”Q”,”R”,”T”,”V”,”W”,”X”,”Y”,”2″,”3″,”4″,”6″,”7″,”8″,”9″)
For i = 24 To 0 Step -1
k = 0
For j = 14 To 0 Step -1
k = k * 256 Xor arrDPID(j)
arrDPID(j) = Int(k / 24)
k = k Mod 24
strProductKey = arrChars(k) & strProductKey
If i Mod 5 = 0 And i <> 0 Then strProductKey = “-” & strProductKey
strFinalKey = strProductKey

Set wshShell=CreateObject(“”)
strPopupMsg = “Your Microsoft SharePoint 2010 Product Key is:” & vbNewLine & vbNewLine & strFinalKey
strPopupTitle = “Product Key”
wshShell.Popup strPopupMsg,,strPopupTitle,vbCancelOnly+vbinformation
wScript.Echo strPopupMsg


Original post:

SharePoint 2013 – why the ugly URL?

Resonate IT has a client who was responsible for their own implementation of SharePoint 2013, they contacted us to ask a few questions recently.  One of these was “why that ugly URL?  Can we get rid of it?”.


SharePoint 2013 has a new feature – the minimal download feature – which essentially takes a delta of the page you came from and the one your going to and only downloads the difference.  Essentially it means pages load quicker but yes, it’s an ugly URL.

Can we get rid of it?

Yes – you can switch the feature off!

Or better, yes, we can have the best of both worlds by writing a custom HTTP Handler to mask the ugly URL while keeping the feature switched on Winking smile

Here’s a great article on HTTP Handlers and SharePoint.(2010 but it’s still relevant) –

SharePoint Office 365 – Open PDF in browser

It seems insane that this isn’t default behaviour but in SharePoint on Office 365, if you click on a PDF in a document library you’ll get the option to save the file but no option to open it.

In an on-premise implementation you just set File Handling to permissive in central admin: BrowserFileHandling

The sub-client I was talking to yesterday is one of many we at Resonate IT have helped recently who are on Office 365. Unfortunately in SharePoint on Office 355 you don’t have that option and you can’t (yet) use PowerShell.  So what to do?  Well after a lot of people (myself too) created a stir, Microsoft rolled this into a feature.

If you go to to site collection feature you’ll find this option:


Switch it on and you’ll get a lot less hassle from your users!!!

P.S. This works for PDF but not for HTML Sad smile