cancel
Showing results for 
Search instead for 
Did you mean: 

Accesing files from a server in a MDK app

fjcarrasco
Active Participant
0 Kudos

Hello experts,

I have a requeriment where I need to open some documents in a file server from my MDK app.

In iOS App Files, I can connect to the server and it creates a new location where I can see the folders/files. Even this new location is visible too in others apps.

Example:

My question is if I can use the nativescript FileSystem module to access this location. In case I can, ¿How should I set this location to get the root content ? I have this:

documents = fileSystemModule.knownFolders.documents();
documents.getEntities()
    .then((entities) => {
        // entities is array with the document's files and folders.
        entities.forEach((entity) => {
            array.push(
                {
                    name: entity.name,
                    path: entity.path,
                    lastModified: entity.lastModified.toString()
                }
            );
        });
    }).catch((err) => {
        // Failed to obtain folder's contents.
        console.log(err.stack);
    });

Thanks

Regards,

Kiko

Accepted Solutions (1)

Accepted Solutions (1)

mingkho
Advisor
Advisor
0 Kudos

Hi Kiko

The server you added inside the iOS Files app is not accessible within other app. It's only visible in other app such as iOS Photos app because the pop up you see when you pressed Share to Files is actually the iOS Files app's Share Extension, so in theory that pop up is running the iOS Files app, not the Photos app anymore.

Based on your screenshot I am guessing you are sharing a photo in the iOS Photos app. The iOS Photos app can't actually directly see any folders or any connected server available in the Files app (it'd be a security concertn if any apps can see all folders or any connected server in the Files app). The Photo app can only trigger and open the share sheet and make the user selected photos available for sharing.

When user press the "Share to Files" options, that will open the iOS Files app's Share Extensions (at this point user is in iOS Files app context) and after the user selected a folder inside it and press DONE, the only thing Photo app can do is to pass the photos that user wanted to share to the Files app's Share Extensions and then the Files app's Share Extensions' code will take care of storing the shared photos into the selected folder (e.g. a folder inside the connected server).

So in short, no, the connected server in the Files app can't be accessed directly from within other apps.

I hope this explains it.

Regards

Ming

Answers (1)

Answers (1)

antonio_rodriguez9
Participant

hello

@ming kho, is there any other way to put inside the app mdk these files documentation, for instance sharepoint, onedrive, etc.

we have a lot of technical documentation about equipment and we want to give direct access from our MDK app that we have developed.

Thanks.

Antonio