SoftTimur
SoftTimur

Reputation: 5510

Can Office add-ins cache files on the local disk?

I have an Office Add-in built using mean-stack. I use File System to create folders and write files to my server.

For example, on the backend I have:

router.post('/httpOnly/mkdir', function (req, res, next) {
    var fs = require('fs');
    var dir = req.body.dir;
    fs.mkdir(dir, 0777, function (err) {
        if (err) {
            if (err.code === "EEXIST") console.log("folder exists")
            else return console.log(err)
        };
        res.json(dir);
    });
});

Now, I want to create folders and write files and cache images to the user's local disk.

For example, custom functions can cache files in <user>\AppData\Local\Microsoft\Office\16.0\Wef\CustomFunctions under Windows.

Although my Add-in is not as native as custom functions, is there somewhere in the user's disk reserved for Add-ins to cache files?

Does JavaScript API for Office has APIs to do so?

Upvotes: 0

Views: 258

Answers (1)

Rick Kirkham
Rick Kirkham

Reputation: 9684

There is no API for directly accessing the user's drive (other than cookies and LocalStorage). This is a security issue in the same way that it would be a security problem if web applications running in a browser could access the user's drive.

Upvotes: 3

Related Questions