Is there any way to get files Id in OfficeJS

36 views Asked by At

I am using Graph API's recently and there is an API get files content by id. Is there any way to get document id so I can call Graph API and get its content ?

Excel.run(function(context) {
    var workbookId = context.workbook.id;
    return context.sync()
        .then(function() {
            console.log("Workbook ID: " + workbookId);
        });
}).catch(function(error) {
    console.log("Error: " + error);
});

I tried this code but it always says undefined

1

There are 1 answers

0
Eugene Astafiev On

The Excel.Workbook class doesn't provide the Id property. But you may find the Id property for the Excel.Worksheet class.

Use the name property instead in case of workbooks.