Is there any support in the Office API to pass arguments to an office add-in? When a word document is opened in Office 365 by clicking on the document URL
Can we pass some querystrings in the URL which is accessible in the add-in environment?
Is there any support in the Office API to pass arguments to an office add-in? When a word document is opened in Office 365 by clicking on the document URL
Can we pass some querystrings in the URL which is accessible in the add-in environment?
 
    
    Yes, you can. You could refer to the following code:
function getParameterByName(name, url) {
    // This URL is written directly, you could replace it with your variable.
    if (!url) url = "https://username-my.sharepoint.com/:w:/r/personal/username_tenantname_onmicrosoft_com/_layouts/15/Doc.aspx?sourcedoc=%7QAF15650B-72D2-447C-BE9C-9201A7F61BA4%7D&file=Document%20158.docx&action=default&mobileredirect=true";
    name = name.replace(/[\[\]]/g, '\\$&');
    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, ' '));  
}
Call:
var sourcedoc = getParameterByName('sourcedoc');
var file = getParameterByName('file');
var action = getParameterByName('action');
var mobileredirect = getParameterByName('mobileredirect');
You could refer to the following link:
