thorsten-wolf-neptune opened a new issue, #833:
URL: https://github.com/apache/cordova-plugin-camera/issues/833

   # Bug Report
   
   ## Problem
   When calling 
   ```js
   navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
       destinationType: Camera.DestinationType.FILE_URI,
       saveToPhotoAlbum: true   });
   ```
   on a Windows 10 or Windows 11 UWP app, the user gets a File Promt to choose 
a location to store the taken picture on his machine.
   When selecting a folder that is managed by Microsoft OneDrive the save of 
the photo fails and you do get a Javascript error 
   
   because execution of the following code:
   ```js
   // Prevent updates to the remote version of the file until we're done
                       Windows.Storage.CachedFileManager.deferUpdates(file);
   ```
   
https://github.com/apache/cordova-plugin-camera/blob/master/src/windows/CameraProxy.js#L810
   Throwing an error:
   ```console
   No such interface supported
   ```
   
![image](https://github.com/apache/cordova-plugin-camera/assets/83953375/4cecf754-ac6d-4d08-9798-85e6070dcbcd)
   When choosing a non OneDrive managed Folder the save works just fine.
   
   ### What is expected to happen?
   calling navigator.camera.getPicture on a Windows UWP app with the 
saveToPhotoAlbum property set to true should allow saving the taken picture in 
any folder of the device.
   
   
   ### What does actually happen?
   Saving fails with a Javascript error.
   ```console
   No such interface supported
   ```
   
   ## Information
   <!-- Include all relevant information that might help understand and 
reproduce the problem -->
   I tried to surround the call with a try catch and with it would catch the 
error in a case where the use selects a OneDrive managed folder and it works.
   If you want i can create a PR for it:
   ```js
                   try {
                       // Prevent updates to the remote version of the file 
until we're done
                       Windows.Storage.CachedFileManager.deferUpdates(file);
                   } catch (ex) {
                       // when a one drive folder is selected this function 
throws an error: "No such interface supported"
                       // the save still works afterwards so just try and catch 
it
                       console.warn(ex);
                   }
   ```
   
![image](https://github.com/apache/cordova-plugin-camera/assets/83953375/d8ecb7ae-dfd2-4628-9a5a-752a01c70a00)
   
![image](https://github.com/apache/cordova-plugin-camera/assets/83953375/3abed231-9119-4fe4-9daa-480146a9a9bc)
   
![image](https://github.com/apache/cordova-plugin-camera/assets/83953375/a3e1fc54-4003-44f9-9969-d763cc3699e5)
   
![image](https://github.com/apache/cordova-plugin-camera/assets/83953375/5e78a90d-6bd4-4264-8522-2e75ea7117af)
   
![image](https://github.com/apache/cordova-plugin-camera/assets/83953375/34dc1702-7548-42a8-81da-07431c692340)
   
![image](https://github.com/apache/cordova-plugin-camera/assets/83953375/76f4ab26-0f9c-4194-9dca-3d7a9bc62823)
   
   
   
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   Create an empty Cordova UWP app and execute the following code in the 
developer tools console:
   ```javascript
   navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
       destinationType: Camera.DestinationType.FILE_URI,
       saveToPhotoAlbum: true   });
   
   function onSuccess(imageURI) {
       debugger;
   }
   
   function onFail(message) {
       debugger;
       alert('Failed because: ' + message);
   }
   ```
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you 
experiencing the issue? -->
   Windows UWP app
   
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   Cordova: Cordova CLI 11.1.0
   Using cordova-fetch for cordova-windows@^7.0.1
   Operating System: Windows 10/11 
   Other Environment: OneDrive (Personal or Business) problem happens with both
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [X] I searched for existing GitHub issues
   - [X] I updated all Cordova tooling to most recent version
   - [X] I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to