Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

May 2017

VIDEO – Angular CLI – Todo List in SharePoint Content Editor

Angular 2 (“Angular”) brings many improvements over Angular 1 (“AngularJS”).  The CLI tools (Command Line Interface) help streamline operations so we can develop professional applications with ease including unit testing, bundling, minification, live preview, webpack, distribution, and more.

The below demo shows how to create a new application, run tests, add features, and deploy to SharePoint Pages hosted in a Content Editor Web Part.  The CLI tools boost developer productivity while holding up quality control.

Check out the live coding video below, hosted on both Vimeo and YouTube.

Leave a comment if you found it helpful.  Cheers! 

shades_smile

Video

Screenshots

image
image
image
image
image

Source Code

Steps

  1. MD TODO
  2. NG NEW TODO
  3. CD TODO
  4. NG SERVE
  5. NG HELP BUILD
  6. NG BUILD -PROD -AOT -D http://portal/sites/todo/SiteAssets/todo -W
  7. Upload all files from local /dist/ to SharePoint /SiteAssets/todo/
  8. Right click “index.html” in SharePoint to copy absolute URL
  9. Edit Page, add Content Editor Web Part (CEWP)
  10. Modify CEWP and provide URL for display
  11. Enjoy!

References

Errors Fixed

https://stackoverflow.com/questions/40386883/sharepoint-angular-2-app-using-cli-webpack

For Angular2 to load correctly on a SharePoint page we must comment out the line “import ‘core-js/es6/string’;” from “polyfills.ts” to avoid conflict with Microsoft Script Resource AXD code already included.

  • Uncaught g {__zone_symbol__error: Error: Sys.ParameterCountException: Parameter count mismatch.
  • polyfills.3737621….bundle.js:1 Uncaught
  • ScriptResource.axd?d=BguhdZbE6Lg8ptBp5skwRENGckVM6n4sP4jY4eLX78z7DZzuMbkeH4dwMKG-9qqtKy6_9p0QSjbOTX…:494 Uncaught

MySite – Export user Quick Links to CSV

When migrating from MySite on-premise to OneDrive in the cloud, Quick Links are not included by third party utilities (i.e. ShareGate).  However, with PowerShell we can export the original raw CSV data and provide a list of links to end users.  They can bookmark or add to Office 365.

Cheers! 

shades_smile

 

Code

# User login parameter
$userLogin = "johndoe"
$mySiteWebApp = Get-SPWebApplication |? {$_.Name -like "*MySite*"}
# Connect to MySite
$site = Get-SPSite $mySiteWebApp.Url
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context);
# Lookup user profile in UPS
$userProfile = $profileManager.GetUserProfile($env:USERDNSDOMAIN + $userLogin);
# Display on console
$userProfile
$userProfile.QuickLinks.GetItems() | Select Title, Url
# Export to CSV file
$userProfile.QuickLinks.GetItems() | Select Title, Url | Export-Csv "C:\temp\$($userLogin)-FollowedLinks.csv" –NoTypeInformation -Force

 

Screenshot

image

 

image

Clone Content Database – SQL Copy + Generate SPSite GUID

Tried of waiting for Backup-SPSite / Restore-SPSite?  Me too.  Why not clone the SQL content database with SQL backup and restore?  

 

Well, SharePoint requires every Site Collection on a given to have a unique GUID.  When we clone a SQL content database and attempt Mount-SPContentDatabase an error comes up that the GUID already exists on the local farm.  No bueno.

Why not generate and replace the GUID?   In theory, we can UDPATE the SQL database internally with fresh new GUID numbers and SharePoint would recognize as new site collections.  No conflict.  That is exactly what the PowerShell below does.  By walking the schema, finding “SiteID” and “tp_SiteID” columns, and replacing the old GUID with a new GUID.

The larger the site collection, the better this works on time savings.  SQL internally can backup and restore a database much faster than waiting for Backup-SPSite/Restore-SPSite to export/import binary data across the wire to the SharePoint front end file system.

In the example below you can see a brand new team site created with GUID “82dad5a8-aa6e-4480-a10e-16cd2597c18b” in a dedicated SQL content database, taken offline, updated with PowerShell to replace old GUID with new GUID “0f59c302-92ea-4fac-b32b-799f3dd41264” and then successfully consumed again.

 

  • NOTE – You still need a unique URL, so be sure to run Mount-SPContentDatabase against a secondary web application.
  • NOTE – This is completely unsupported.  Use at your own risk.   Worked well on Dev and Test environments for me.

 

PowerShell Source Code

 

Context Diagram

image

Screenshots

image
image
image
image
image
image
image
image
image

 

 

References

What’s in that patch? May 2017

NOTE – PDF format updated to include both SharePoint 2013 and 2016 notes.

 

Ever wondered what fixes are inside of a given CU?   Please see attached PDF with full detail. I wanted a new format for easy reading.   Show management and make the business case for why downtime should be taken to apply CUs.  Also posted at http://sharepointupdates.com/

If you found this helpful, please leave a comment.   

shades_smile_thumb_thumb_thumb_thumb[2]

 

Download

What’s in that patch – May 2017.PDF

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲