Access to files in OneDrive denied in Hololens 2018

Hi!

My app uploads a file (.jt - cad type) from OneDrive to Hololens, using this piece of code:

protected override void OnFileActivated(FileActivatedEventArgs args)
{
string appArgs = "";

   splashScreen = args.SplashScreen;
   appArgs += "File=";
   bool firstFileAdded = false;
   List<string> filePaths = new List<string>();

foreach (var file in args.Files)
{
filePaths.Add(file.Path);

          if (firstFileAdded) appArgs += ";";
          appArgs += file.Path;
          firstFileAdded = true;
    }

    InitializeUnity(appArgs);

    if (filePaths.Count > 0)
       DataLoadManager.LoadExternalFile(filePaths[0]);
    }

//DataLoadManager
public void Update()
{
if (loadExternalFilePath != null)
{
string path = loadExternalFilePath;
loadExternalFilePath = null;
string newPath = Application.temporaryCachePath + Path.DirectorySeparatorChar + Path.GetFileName(path);

General.Instance.DebugTime("DataLoderManager::Update::" + Path.GetFileName(path));

if (File.Exists(newPath))
{
    File.Delete(newPath);
}

    File.Copy(path, newPath); //Exception!

File.SetAttributes(newPath, FileAttributes.Normal);
.....
}

The upload worked fine on the previous version but I’ve just updated my Hololens’ version and started getting this exception:

System.UnauthorizedAccessException:'Access to the path 'C:\Data\Users\pleas\AppData\Local\Packages\microsoft.microsoftskydrive_8wekyb3d8bbwe\LocalState\OpenFile\ is denied.'

When I tried uploading the file from a different folder in Hololens (such as: Pictures or 3DObjects) it worked fine.
Is it still possible to upload files from OneDrive in the new version? If so, how can I solve this issue?
Note: I'm using Unity 5.6.2f1 (64-bit).

Thank you for your help.

Sign In or Register to comment.