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
```

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);
}
```






### 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]