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
O365 - SP2013 - Mount a folder to another folder or OneDrive - 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

2014-07-10

Its been a month since I downloaded the latest version of the O365 assemblies and with no suprise O365 assemblies are updated with the new functionality. One of the main thing I found it is ability to mount folder to another folder or to the one drive.

New CSOM api (Microsoft.SharePoint.Client.MountPoint) is available to create and retrieve a mount point.

1. Create a mount point to the target folder in a folder or a One Drive.

Method: MountPoint.CreateMountPoint(ClientRuntimeContext context, Folder folder, string name, Guid targetSiteId, Guid targetWebId, Guid targetUniqueId)

Parameters:
a. Runtime Context
b. Source folder object
c. Mount Name (string)
d. Mount Point Target folder Site Id (GUID)
e. Mount Point Target folder Web Id (GUID)
f. Mount Point Target folder Id (GUID)

if the Source folder is null, it creates the mount point in the One Drive root folder.

The above creates a Shortcut / MountPoint file (as “.url” extension) in the Source folder with the content as

https://***.sharepoint.com/sites/_layouts/16/mountpoint.aspx?site=<<Target folder site ID>>&web=<<Target Folder Web ID>>&item=<<Target Folder ID>>

2. Get the list of mounted folder urls in a list.

Method: MountPoint.GetMountedFolderUrls(ClientRuntimeContext context, List list)

Example:

ClientContext context = new ClientContext("https://****.sharepoint.com/site");
string password = "********";
var secure = new SecureString();
foreach (var c in password.ToCharArray()) secure.AppendChar(c);
context.Credentials = new SharePointOnlineCredentials("***@****.onmicrosoft.com", secure);
context.Load(context.Web,w=>w.Title,w=>w.Id);
context.Load(context.Site, s => s.Id);
List sourceList = context.Web.Lists.GetByTitle("Source Library");
context.Load(sourceList,sl=>sl.Fields);
Folder sourceListFolder = sourceList.RootFolder.Folders.GetByUrl("source");
context.Load(sourceListFolder,s=>s.UniqueId,s=>s.Files,s=>s.ListItemAllFields);
List targetList = context.Web.Lists.GetByTitle("Target Library");
context.Load(targetList);
Folder targetListFolder = targetList.RootFolder.Folders.GetByUrl("target");
context.Load(targetListFolder,t=>t.UniqueId);
MountPoint.CreateMountPoint(context, sourceListFolder, "hellomount",context.Site.Id, context.Web.Id,targetListFolder.UniqueId);
context.ExecuteQuery();


The above code, creates a mount point for the “target” folder of the “Target Library” in the “Source” folder of the “Source Library”

I think, when we click this MountPoint shortcut, it should redirect the user to the target folder page using the “_layouts/15/MountPoint.aspx” page. For some reason, the redirect is failing which I need to look into it in details.

At the moment, When the user creates a mount using the same name, it appends a number to create a unique name. Also, When the user creates a mount point in a list, it creates the following hidden field in the Source list,

SPMountPointManager.EnsureMetadataField(list, SPFieldType.Boolean.ToString(),”_mpIsFolder”, true);
SPMountPointManager.EnsureMetadataField(list, SPFieldType.Guid.ToString(), “_mpSPSiteId”, false);
SPMountPointManager.EnsureMetadataField(list, SPFieldType.Guid.ToString(), “_mpSPWebId”, false);
SPMountPointManager.EnsureMetadataField(list, SPFieldType.Guid.ToString(), “_mpItemUniqueId”, false);

Note: This feature is not yet published yet. But it gives an idea of the features coming for the O365.

(Visited 258 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.