28 December 2020

Extensions enhancement - IsStrong() method added

The .IsStrong() method was added to both the System.String and System.Text.StringBuilder objects.  It allows the developer the ability to quickly check if a string is a valid strong password e.g.

"blog.cjvandyk.com Rocks!".IsStrong()

will return True.  You can limit the number of aspect matches thus:

"blog.cjvandyk.com rocks!".IsStrong(3)

which returns True because 3 of the 4 aspects are matched in upper case, lower case and special characters.  Not passing an aspect number results in all 4 being required thus:

"blog.cjvandyk.com rocks!".IsStrong()

Will return False.


For a more detail of what Extensions offer, see:







Add Extensions to your toolbox and make your coding life a little easier.  

Happy coding
C

21 December 2020

Extensions enhancement - HasSymbol() method added

The .HasSymbol() method was added to both the System.String and System.Text.StringBuilder objects.  It allows the developer the ability to quickly check if a string contains symbols or special characters e.g.

"blog.cjvandyk.com Rocks!".HasSymbol()

will return True whereas:

"blogcjvandykcom".HasSymbol()

will return False.


For a more detail of what Extensions offer, see:







Add Extensions to your toolbox and make your coding life a little easier.  

Happy coding
C

07 December 2020

How do I - Check if a field is empty in PowerAutomate?

In PowerAutomate there is a empty() function that can be used, but it doesn't work the way you think.  Take the following example from a mentee question:


In this Set variable action, we are trying to set varFundDateExists to true or false depending on if there's a value in the "RD Funded Expiration Date" control.  The attempt used here is:

@not(empty(items()?['RD_x0020_Funded_x0020_Expiration_x0020_Date']))

Unfortunately, the empty() function doesn't work as expected.  How do we solve this problem then?

I've seen this suggested solution on powerusers.microsoft.com where doing a date calculation allows you to determine if the target date field is blank:

Value(Today()) - Value(items()?['RD_x0020_Funded_x0020_Expiration_x0020_Date']) = Value(Today())

The theory is that if there is a date in the target field, the value won't match today's date and return false.  The exception to this is when the target field contains today's date in which case it will return true.

The best way to do the check is as follows:

Equals(['RD_x0020_Funded_x0020_Expiration_x0020_Date'], null)


Happy coding...
C


02 December 2020

SharePoint Remote Event Receivers List

Here is the complete list of Remote Event Receivers available in Microsoft.SharePoint.Client.EventReceivers.SPRemoteEventType:

 AppInstalled

AppUninstalling

AppUpgraded

EntityInstanceAdded

EntityInstanceDeleted

EntityInstanceUpdated

FieldAdded

FieldAdding

FieldDeleted

FieldDeleting

FieldUpdated

FieldUpdating

GroupAdded

GroupAdding

GroupDeleted

GroupDeleting

GroupUpdated

GroupUpdating

GroupUserAdded

GroupUserAdding

GroupUserDeleted

GroupUserDeleting

InheritanceBreaking

InheritanceBroken

InheritanceReset

InheritanceResetting

ItemAdded

ItemAdding

ItemAttachmentAdded

ItemAttachmentAdding

ItemAttachmentDeleted

ItemAttachmentDeleting

ItemCheckedIn

ItemCheckedOut

ItemCheckingIn

ItemCheckingOut

ItemDeleted

ItemDeleting

ItemFileConverted

ItemFileMoved

ItemFileMoving

ItemUncheckedOut

ItemUncheckingOut

ItemUpdated

ItemUpdating

ItemVersionDeleted

ItemVersionDeleting

ListAdded

ListAdding

ListDeleted

ListDeleting

RoleAssignmentAdded

RoleAssignmentAdding

RoleAssignmentDeleted

RoleAssignmentDeleting

RoleDefinitionAdded

RoleDefinitionAdding

RoleDefinitionDeleted

RoleDefinitionDeleting

RoleDefinitionUpdated

RoleDefinitionUpdating

SiteDeleted

SiteDeleting

WebAdding

WebDeleted

WebDeleting

WebMoved

WebMoving

WebProvisioned

WebRestored


Happy coding!
C

30 November 2020

Failed to create the Common Data Service database in this environment with status code CRMLicenseRequired

I encountered another parity problem between GCCHigh and commercial M365 today.  This time it's in PowerAutomate when using Approvals.

My workflow contains a simple Approval as seen below.


PowerAutomate allows me to save the flow just fine.  So far so good.  Now we attempt to test the flow and the following error is generated:


When we drill down into the flow status, we see the following:



To be clear, there isn't much more in here than the 409 status code.
In order to validate the problem, we did the following:
  1. Provisioned a commercial tenant with NO database in the Common Database Service (CDS).
  2. Created a PowerAutomate flow with an Approval like in GCCHigh.
  3. Triggered the flow to test it.
It took a little while, but the approval request came through.  The delay was due to a database being spun up in CDS, even though the tenant did NOT have a license for CDS.

Conclusion: There is a parity mismatch between commercial and GCCHigh when attempting to use Approvals in PowerAutomate.  In GCCHigh, a CDS license is required.

Enjoy
C


23 November 2020

How do I - Open support cases for GCCHigh?

 The first thing newcomers to GCCHigh want to know is how to open support cases.  There are a couple of things to note as laid out in the Microsoft Docs on the subject.

  • You must be an administrator for the area for which you intend to open a support case.  That means if your case is about SharePoint Online, you must be configured in your tenant as a SharePoint Administrator.  The Microsoft Docs provide more detail on managing admins etc.
  • What the docs do not (presently) provide is actual links and directions to a starting point.  I have submitted a pull request to update the docs which will address this shortfall.  In the mean time I'll provide the guidance here:
    • Navigate your browser to https://portal.office365.us/adminportal.
    • Using the New Admin Center, navigate to Show all > Support > New Service Request.
    • Use the Subject to provide a brief description of the problem.
Hope that helps.
C

16 November 2020

It's a whole new world!

 If you've been following my blog for a while, you know that I live in the SharePoint world and blog mostly about SharePoint related topics.  I haven't had time to blog lately in part because I've been involved in a major migration effort to GCCHigh which is Microsoft's new ultra secure 365 world for DoD clients.

As we all know, security and ease of collaboration are polar opposites of the same sliding scale.  The more secure a system is, the harder collaboration in that system is going to be.  That means that there isn't parity between commercial 365 features and GCCHigh 365 features.  This can make for some frustrating times especially because ALL documentation from docs.microsoft.com is usually related to commercial 365.

Going forward, I will attempt to provide some tips, tricks and tutorials for working in the GCCHigh environment on a variety of topics like:

  • SharePoint Online in GCCHigh.
  • PowerApps in GCCHigh.
  • PowerAutomate in GCCHigh.
  • Teams in GCCHigh.
  • Azure Information Protection in GCCHigh.
  • and many more...
So stay tuned as we pivot this blog from traditional commercial SharePoint content to more specialized cloud content.

Later
C

09 November 2020

Extensions enhancement - HasNumeric() method added

The .HasNumeric() method was added to both the System.String and System.Text.StringBuilder objects.  It allows the developer the ability to quickly check if a string contains numeric values e.g.

"blog.cjvandyk.com Rocks!".HasNumeric()

will return False whereas:

"blog.cjvandyk.com Rocks 4 sure!".HasNumeric()

will return True.


For a more detail of what Extensions offer, see:







Add Extensions to your toolbox and make your coding life a little easier.  

Happy coding
C

02 November 2020

Extensions enhancement - HasUpper() method added.

The .HasUpper() method was added to both the System.String and System.Text.StringBuilder objects.  It allows the developer the ability to quickly check if a string contains numeric values e.g.

"blog.cjvandyk.com Rocks!".HasUpper()

will return True whereas:

"blog.cjvandyk.com rocks!".HasUpper()

will return False.


For a more detail of what Extensions offer, see:







Add Extensions to your toolbox and make your coding life a little easier.  

Happy coding
C

26 October 2020

Extensions enhancement - HasLower() method added

The .HasLower() method was added to both the System.String and System.Text.StringBuilder objects.  It allows the developer the ability to quickly check if a string contains numeric values e.g.

"blog.cjvandyk.com Rocks!".HasLower()

will return True whereas:

"BLOG.CJVANDYK.COM ROCKS!".HasLower()

will return False.


For a more detail of what Extensions offer, see:







Add Extensions to your toolbox and make your coding life a little easier.  

Happy coding
C

11 May 2020

Operator '&&' cannot be applied to operands of type 'bool' and 'bool?'

How do I fix the compiler error "Operator '&&' cannot be applied to operands of type 'bool' and 'bool?'"
I got this question from a mentee the other day.  They were trying to do the following:

foreach (var user in dbContext.Users.Where(
         u => roles.Contains(targetRole) && 
         u.Valid ?? false == true))
{
   <code...>
}

Unfortunately, they kept getting the compiler error above.  The Valid field in the database is configured as a bit value that is nullable and they want it to return false if it's null.
The fix is straight forward by simply using parentheses thus:

foreach (var user in dbContext.Users.Where(
         u => roles.Contains(targetRole) && 
         (u.Valid ?? false)))
{
   <code...>
}

The double question mark (??) tells C# to return the following value if the preceding is null.  If it isn't null, it will simply process the value as either true or false.

Later
C

04 May 2020

How do I - Convert a SharePoint List Private View to a Public View?

Have you ever started creating a list view in SharePoint and because you're experimenting, you chose to make it a "Private" view?  Then before long the view evolves to be extremely useful in your work, but you cannot make it public for others to see and use?
Well fear no more.  This guide will walk you through Step-by-Step on how to convert your existing private list views into new public views that everyone can use.

1.  Begin by navigating to the target list.  In my example, I have a list called "Demo Convert Views" in which I created a personal view called "Cs Private View" which has several customizations for demo purposes.













2.  Now double click the ellipses (...) and from the dropdown menu, click the "Create View" option.











3.  The View Type page will allow you to define your view in different formats, but we're more interested in the "Start from an existing view" option at the bottom.  Here all current views accessible to you, INCLUDING your Personal Views, are listed.  You can thus clone a view from any of those.  In our case, we're going to click on the "Cs Private View" to use it as the foundation for the new view.

























4.  The problem quickly becomes apparent when we see that our "View Audience" selection is locked into "Create a Personal View" because the view we used as a base was a personal view.  Herein lies the problem.  Time to put on your white hat and get hacking.











5.  We begin by activating the Developer Mode (in IE) or the Element Inspector (in Chrome).
6.  To activate IE Developer Mode, press the F12 key.  You should now have a panel open up below displaying the underlying HTML for the page.  Ensure that you're on the "DOM Explorer" tab.


























7.  Now it is time to expand the DOM in search of that "Create a Public View" radio button.
8.  Expand the "<form" section.
9.  Scroll to the bottom of the "<form>" tag and locate the "<div class="ms-core-overlay"" tag and expand it.







10.  Inside that tag, locate the "<div id="contentRow">" tag and expand it.
11.  Inside that tag, locate the "<div id="contentBox"" tag and expand it.
12.  Inside that tag, locate the "<div id="DeltaPlaceHolderMain">" tag and expand it.
13.  Inside that tag, locate the "<table width="100%" class="ms-v4propertysheetspacing"" tag and expand it.
14.  Inside that tag, locate the "<tbody>" tag and expand it.
15.  Inside that tag, locate the "<tr>" tag and expand it.
16.  Inside that tag, locate the "<td>" tag and expand it.





















17.  Scroll down past the series of "<input>" tags to the "<table" tag below them and expand that.
18.  Inside that tag, locate the "<tbody>" tag and expand it.
19.  There will be several "<tr>" tags.  Scroll down and locate the "<!--Audience-->" marker and expand the 4th "<tr>" tag below it.
20.  Inside that tag, locate the "<td class="ms-authoringcontrols" id="onetidViewAudience">" tag and expand it.
21.  Inside that tag, locate the "<table>" tag and expand it.
22.  Inside that tag, locate the "<tbody>" tag and expand it.



























23.  Inside that tag, locate the 3rd "<tr>" tag and expand it.
24.  Inside that tag, locate the 2nd "<td>" tag and expand it.
25.  You should now see an "<input>" tag.
















26.  You will notice the tag has a property called "disabled=""".  We want to delete this property, but that's not as straight forward as it sounds.
27.  Double click on the word "disabled".
28.  The browser would now give you the ability to change the name of the tag.



29.  Delete the tag by pressing the "Delete" key on your keyboard while it's selected.
30.  Now press "Enter".
31.  You will notice the "<input>" tag now looks a little weird, but that's OK.




32.  Next you want to right click on the "<input>" tag line.
33.  From the dropdown, click "Delete element".
34.  The entire line should now disappear.





35.  Now press "Ctrl+Z" on your keyboard to bring the element line back.
36.  You will notice that the weird ="" text is no longer there.







37.  You can now close the developer panel.
38.  You will notice that you can now change the radio button for the "View Audience" from "Create a Personal View" to "Create a Public View".
39.  Name your view and click the "OK" button to save the new view.





















40.  Your Personal view has now been cloned into an exact replica Public view!  😎













Happy coding.
C

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

30 March 2020

How do I - Fix the "You must add a reference to assembly netstandard" error?

When using NuGet, we can easily run into assembly reference issues.  A notorious error message is:

CS0012: The type ‘System.Object’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’.

This can be very confusing especially if your app is NOT using the .NET Standard library at all.  Luckily the fix is easy enough.  Simply crack open your app.config or web.config file and added the following:

Happy coding.
C

23 March 2020

How do I - Calculate time difference between two date objects in C#?

The time difference between two date objects is easily calculated using the TimeSpan class thus:


Happy coding
C

15 January 2020

TLS 1.0 and 1.1 is now deprecated in GCCHigh

 Microsoft announced some time ago that TLS 1.0 and 1.1 would be deprecated in GCCHigh.  As of today, you can no longer connect to GCCHigh if your browser isn't configured for TLS 1.2.  In fact, there are many problems when network connectivity is done between nodes that support multiple versions of TLS.  It's recommended that we all fully embrace TLS 1.2 and turn 1.0 and 1.1 off completely.

Happy coding...
C


SharePoint Remote Event Receivers are DEAD!!!

 Well, the time has finally come.  It was evident when Microsoft started pushing everyone to WebHooks, but this FAQ and related announcement...