Export (0) Print
Expand All

Document.url property (JavaScript API for Office v1.1)

JavaScript API for Office v1.1

Gets the URL of the document that the host application currently has open.

Last modified: June 12, 2014

Introduced in Office.js version


Updated in Office.js version


var docUrl = Office.context.document.url;

The URL of the document. Returns null if the URL is unavailable.

Important: The url property returns information that may contain personally identifiable information (PII) in the name of the document and location where it is stored. If you must store or transmit this information, be sure to do so in an encrypted format.

Added support for content apps for Access.

function displayDocumentUrl() {

// Function that writes to a div with id='message' on the page.
function write(message){
    document.getElementById('message').innerText += message; 

App types

Content apps, Task pane apps

Supported clients

Access app for SharePoint, Excel 2013, Excel 2013 SP1, Excel 2013 RT, Excel Online, Word 2013, Word 2013 SP1, Word 2013 RT, Project 2013 SP1, and Project 2013





© 2014 Microsoft