共用方式為


Ewa.Workbook.getSessionId()

Applies to: apps for SharePoint | SharePoint Server 2010

In this article
Return Value
Remarks
Example
Applies To

Gets the session identifier.

var value = Ewa.Workbook.getSessionId();

Return Value

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.

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

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

function getEwa()
{            
    // 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