Share via


Ewa.Workbook.getSessionId()

Applies to: apps for SharePoint | Excel Services | SharePoint Server 2013

In this article
Return Value
Remarks
Example
Applies To

Gets the session identifier.

var value = Ewa.Workbook.getSessionId();

Return Value

Type: String

Remarks

The [Ewa.Workbook.getSessionId] method returns the session ID for the user session.

Example

The following code example shows how to display the session ID in the browser status bar after the page loads. The code example assumes that you are working with an Excel Web Access Web Part on SharePoint Server 2013.

<script type="text/javascript">
     
var ewa = null;
    
// Add event handler for onload event.
if (window.attachEvent) 
{ 
    window.attachEvent("onload", ewaOnPageLoad);    
} 
else 
{ 
    window.addEventListener("DOMContentLoaded", ewaOnPageLoad, false); 
}

// Add event handler for applicationReady event.
function ewaOnPageLoad() 
{         
    Ewa.EwaControl.add_applicationReady(onApplicationReady); 
} 

function onApplicationReady()
{            
    // Get a reference to the Excel Services Web Part.
    ewa = Ewa.EwaControl.getInstances().getItem(0);    
     
    // Display session ID in browser status bar.
    window.status =  "The session ID is " + ewa.getActiveWorkbook().getSessionId() + ".";                                
}              
      
</script>

Applies To

Ewa.Workbook Object

See also

Concepts

Ewa.Workbook Methods

Ewa namespace