Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 7025

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 2162

Deprecated: Hook imagify_allow_picture_tags_for_webp is deprecated since version 2.2! Use imagify_allow_picture_tags_for_nextgen instead. in /www/collab365_296/public/wp-includes/functions.php on line 5758
How to use the SharePoint MountPoint API to create a shortcut to a file or folder - Collab365
Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Warning: Undefined array key "url" in /www/collab365_296/public/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/smart-site/classes/class-tvd-smart-shortcodes.php on line 85

2015-09-18

SharePoint 2016 and Office 365 now includes the Mount files or folders api using CSOM and JSOM.

The Javascript SP.MountPoint api allows us to create a shortcut url containing the link.

[InternetShortcut]
URL=https://***.sharepoint.com/_layouts/15/mountpoint.aspx?site=9377021dbbfe4c65bf2910274e2b5ca4&web=5f698c8ec9544498bea63d6e2dc6fb23&item=17cb837e3d204e3ebb3b650ac2922a7d

The above contains the link to the _layouts/15/mountpoint.aspx which takes the following parameters,

  • Site Id.
  • Web Id
  • Item Id

When clicked the link will redirect to the correct folder or file.

The example below creates the shortcut url in the specified folder using the JSOM and the equivalent CSOM is also available.

Initialise the parameters:

var context = SP.ClientContext.get_current();
var sourceWeb = context.get_web();
var sourceFolder = sourceWeb.getFolderByServerRelativeUrl("/sitepages/folder");
context.load(sourceFolder);
context.load(sourceWeb);
var targetSite = context.get_site();
context.load(targetSite);
context.executeQueryAsync(function(){},function(){});

Create the MountPoint:

SP.MountPoint.createMountPoint(context,   targetFolder, "Mount_Name", targetSite.get_id(),
sourceWeb.get_id(),
 sourceFolder.get_uniqueId());
context.executeQueryAsync(function(){},function(){});
  • The above script creates the Mount_Name.url file within the targetFolder for the specified sourceFolder.

(Visited 531 times, 1 visits today)

About the author 

Balamurugan Kailasam

Summit Bundle

Get 200+ hours of Microsoft 365 Training for 27$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos and 108 Ebooks in the Collab365 Academy. This offer is insane and is only available for a limited period.