There is an embedded integration of OneDrive in Cameyo session (see: Connecting Cloud Storage for a User), however this doesn't include SharePoint shared drives.


To integrate SharePoint drives to your Cameyo session, follow these steps:


Installation:

  1. Install WinFSP (https://winfsp.dev/rel) on your Cameyo server

  2. Copy the attached bitmap file (Dlg.SharePoint.bmp) to c:\RemoteAppPilot

  3. Reboot the server

  4. Connect to an Admin Session and create the following file:
    c:\ProgramData\Cameyo\StartWithSharePoint.ps1

    with this content:
    $rcloneConfig = $env:SHAREPOINT_CONFIG
    $rcloneExePath = "c:\temp\rclone\rclone.exe"
    $rcloneConfigPath = "$env:APPDATA\rclone\$rcloneConfig.conf"
    $url = $env:SHAREPOINT_URL
    $documents = $env:SHAREPOINT_DOCS
    
    do {
    if (-not (Test-Path -Path $rcloneConfigPath )) {    
        $cred = Get-Credential -Message "SharePoint Login [$rcloneConfig]"
        $pass = $cred.GetNetworkCredential().password
        $user = $cred.GetNetworkCredential().UserName
        $rclonepw = & $rcloneExePath obscure $pass
        $config = @"
    [SharePoint]
    type = webdav
    url = $url
    vendor = sharepoint
    user = $user
    pass = $rclonepw
    "@
    
        Set-Content -Path $rcloneConfigPath -Value $config
    }
     
    Start-Process $rcloneExePath -ArgumentList "--config ""$env:APPDATA\rclone\$rcloneConfig.conf"" mount ""SharePoint:$documents"" S: --vfs-cache-mode full -v" -WindowStyle Hidden
    Sleep -Seconds 2
    if ((-not (Test-Path S:)) -and (Test-Path -Path $rcloneConfigPath)) { Remove-Item $rcloneConfigPath}
    } while (-not (Test-Path S:))
    
    if ($env:SHAREPOINT_ARGS -ne "") {
        Start-Process $env:SHAREPOINT_CMD -ArgumentList "$env:SHAREPOINT_ARGS"  -WindowStyle Maximized
    } else {
        Start-Process $env:SHAREPOINT_CMD -WindowStyle Maximized
    }

  5. Create an App with the following command line and parameters:
    PowerShell.exe
    -WindowStyle Minimized -File c:\ProgramData\Cameyo\StartWithSharePoint.ps1

    and the following PowerTags (explained below):
    !FILEDIALOG_EXTRA=SharePoint>0>S:\
    SHAREPOINT_URL=https://mycompany.sharepoint.com/sites/CompanyFiles
    SHAREPOINT_DOCS=Shared Documents
    SHAREPOINT_CONFIG=General
    SHAREPOINT_CMD=Wordpad.exe
    optional:
    SHAREPOINT_ARGS=x:\Documents\MyDoc.rtf


PowerTags explanation:

  • SHAREPOINT_URL
    The base URL to the SharePoint site:


  • SHAREPOINT_DOCS
    The documents subfolder name (followed the URL above):
    URL encodings need to be remove (%20 = space)

  • SHAREPOINT_CONFIG
    The name of the config file (only used internally). If the same user needs to have access to multiple SharePoint sites, this is the way to distinct them

  • SHAREPOINT_CMD
    Command line to be executed to start the app (without arguments!)

  • SHAREPOINT_ARGS
    Command line arguments (if needed). Must be left away if there aren't any command line parameters




Result:

The first time a user starts a session he will be prompted with the following dialog where the Office 365 credentials (for OneDrive) need to be entered:

The config is then saved in the user profile and not asked for credentials anymore until the password changes. (if persistence is enabled on the server)


When opening or saving a file from the app the user then will see the following dialog:



The drive letter can be changed but needs to be changed in all places in the script as well as in the PowerTag


If you change the name SharePoint (in !FILEDIALOG_EXTRA) to something else, you also have to rename the bitmap file accordingly