IT Administrators may want to redirect users' My Documents folders to Box Sync. This type of configuration would allow an organization's users to use their My Documents folder as they're accustomed to, while providing added benefits of having those files backed up to the user's Box account. This is also convenient for certain applications that default to save documents to My Documents.
This guide will walk through two ways an administrator can create an end user-initiated utility to assist in this type of folder redirection.
Method 1: Utilizing Microsoft APIs
Method 2: Utilizing Changes to End Users' Registries
Microsoft APIs
Use of Microsoft APIs allows for a more streamlined solution and does not require end users to restart their machines for the changes to take effect. The information referenced within this section can be written in any language that can access COM APIs (e.g., C, C++, C#, Python, Perl).
The following flags are recommended for use:
Flag
|
Description
|
KF_REDIRECT_COPY_CONTENTS |
This copies the existing contents (both the files and subfolders) of the known folder to the redirected folder location. |
KF_REDIRECT_DEL_SOURCE_CONTENTS |
This deletes the contents of the source folder after they have been copied to the redirected folder. |
KF_REDIRECT_UNPIN |
This unpins the source folder. |
KF_REDIRECT_PIN |
This pins the target folder.
|
Example Code (written in C)
// Create the KnownFolderManager object
IKnownFolderManager *folderManager = 0;
CoCreateInstance(CLSID_KnownFolderManager, NULL, CLSCTX_ALL,
IID_IKnownFolderManager, (void **)&folderManager);
// Perform the redirection
LPWSTR error;
folderManager->Redirect(FOLDERID_Documents, NULL,
KF_REDIRECT_COPY_CONTENTS |
KF_REDIRECT_DEL_SOURCE_CONTENTS |
KF_REDIRECT_UNPIN | KF_REDIRECT_PIN,
boxSyncDocumentsPath, 0, NULL, &error);
Registry Changes
Use of registry changes is a secondary approach that can be used by administrators to redirect the user's Desktop. Documents, Favorites, Pictures, Music, Video, etc. folders to point to folders inside the Box Sync folder. Please note that this option requires a restart to the users' machines before the change takes effect, and that any movement of files may cause document paths to change. As a result, users may experience unintended impacts (e.g., accessing an old file through "Recent Files" may fail).
With this redirection in place, applications will, by default, offer to save files in these folders, and saved documents will automatically be uploaded to Box.
Configuration changes should be made by going to the registry at:
To migrate all content within a user's default My Documents folder, the following folders will need to be created within the user's Box Sync folder:
- Box Sync\FileSync\Desktop
- Box Sync\FileSync\Documents
- Box Sync\FileSync\Favorites
- Box Sync\FileSync\Pictures
- Box Sync\FileSync\Music
- Box Sync\FileSync\Video
Below are the configuration changes that should be made:
Registry Value (Example)
|
Old Value (Example)
|
New Value (Example)
|
Desktop |
%USERPROFILE%\Desktop |
%USERPROFILE%\Box Sync\FileSync\Desktop |
Personal |
%USERPROFILE%\Documents |
%USERPROFILE%\Box Sync\FileSync\Documents |
Favorites |
%USERPROFILE%\Favorites |
%USERPROFILE%\Box Sync\FileSync\Favorites |
Pictures |
%USERPROFILE%\Pictures |
%USERPROFILE%\Box Sync\FileSync\Pictures |
Music |
%USERPROFILE%\Music |
%USERPROFILE%\Box Sync\FileSync\Music |
Video |
%USERPROFILE%\Video |
%USERPROFILE%\Box Sync\FileSync\Video |
Note: On Windows 10, it is a known issue that the 'Quick Access' links do not work in this configuration.
Example Code
______________________
Disclaimer
The configurations identified in this document are not officially supported by Box and any configuration changes performed by users or organizations are at your own risk. As these configurations reference changes made to individual machines, Box User Services is not able to provide support and assistance in trouble shooting any issues encountered.
tech_writers_swarm_kb