SharePoint 2016 (Preview) and O365 has the Mount files or folders api using CSOM and JSOM.
The Javascript SP.MountPoint api allows us to create the shortcut url containing the link.
[InternetShortcut]
URL=http://ift.tt/1Yj4lwq
The above contains the link to the _layouts/15/mountpoint.aspx which takes the following parameters,
- Site Id.
- Web Id
- Item Id
which is then used to redirect to the specified folder/files.
The below example 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.
by Balamurugan Kailasam via Everyone's Blog Posts - SharePoint Community
No comments:
Post a Comment