27 April 2020

How do I - Retrieve the LoaderExceptions property?

If you've spent any time in the SharePoint world lately, you've undoubtedly been exposed to the PnP project and it's super powerful extensions for SharePoint.  While PnP is not officially supported by Microsoft, it is Community Supported by the SharePoint Product Team.  PnP can be very fussy at times with strict dependencies on very specific DLL versions.  The most frustrating thing is when you are presented with this error:

Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

I never understood why the exception code that is throwing the error doesn't just provide the LoaderExceptions info in the error message, but such is life.  When we get this error, we can deal with it in the following manner:

Happy coding
C

20 April 2020

How do I - Format a numerical value in a calculated SharePoint field?

If we remember our SharePoint Power Tip on calculated fields, then we'd know we can use Excel formulas to make this work the way we want.  In my case, I was trying to display the age of a ticket in days, on it's InfoPath customized form.  Sounds easy enough right?

NOW() - Created

That should do it, right?
Unfortunately, that displayed a value with fractions.  Not quite what we want.  OK, so let's just round the thing then, and while we're at it, round it to 0 decimals thus:

ROUND(NOW() - Created, 0)

Alas, that did not do it either.  Hopping into Excel, I used text formatting to achieve the goal.  The final calculation was:

=TEXT(ROUND(NOW() - Created, 0), "0")

Happy coding.
C

13 April 2020

SharePoint Power Tip - Calculated field formulas

When we are dealing with Calculated fields in SharePoint lists, it's good to remember that lists are basically Excel sheets.  To whit, we can use almost all the same formulas in a calculated field as we do in Excel.  I often go into Excel to work out my formula (since the interactive error messages are better) and then just copy the formula from Excel to my field definition in SharePoint.
If it works in Excel, it probably works in SharePoint! 😉

Happy coding.
C

06 April 2020

Which NuGet package contains System.Web.Http?

NuGet is a wonderful thing, but when the package name does NOT reflect the DLL name you're looking for, it can become quite a harrowing experience!  Such has been the case with the System.Web.Http.  Note that I said System.Web.Http and NOT System.Net.Http! 😉
This little gem finds itself embedded deep inside the Microsoft.AspNet.WebApi.Core package.  I can't believe we weren't able to infer the package name from the DLL.  😇

Happy coding.
C

Microsoft Authentication Library (MSAL) Overview

The Microsoft Authentication Library (MSAL) is a powerful library designed to simplify the authentication process for applications that conn...