Export (0) Print
Expand All

SpreadsheetLauncher.GetCLSID Method

Last modified: February 02, 2010

Applies to: SharePoint Foundation 2010

Gets the class identifier (CLSID) of the SpreadsheetLauncher control.


expression.GetCLSID()

expression

An expression that returns a SpreadsheetLauncher object.

A String that contains the CLSID.

Use the CLSID value to construct an <OBJECT> tag to which Internet Explorer can bind calls.

This example uses the SpreadsheetLauncher.ImportList Method method to import data from a spreadsheet to a SharePoint site. After creating a SpreadsheetLauncher object, the example uses the GetCLSID method to construct an <OBJECT> tag for writing the object to the page.

<SCRIPT language="JavaScript">
SpreadsheetLauncherButton = new ActiveXObject("SharePoint.SpreadsheetLauncher.2");

if (SpreadsheetLauncherButton) {
   var launcherCLSID = SpreadsheetLauncherButton.GetCLSID();
   var objectTag = '<OBJECT classid="clsid:' + launcherCLSID + '" 
      id="SpreadsheetLauncherObj" style="display:none;"></OBJECT>';

   document.write(objectTag); }

function DoImportSpreadsheet(){
   var form = document.frmNewList;
   var resultUrl;

   resultUrl = SpreadsheetLauncherObj.ImportList(form['List'].value," ", false, 'http://STSServer1/_vti_bin/owssvr.dll?CS=109&');
   window.parent.location.assign(resultUrl);
   return false;}
</SCRIPT>

The previous example assumes the existence of a form such as the following, which calls the DoImportSpreadsheet function and passes several INPUT values to the server.

<FORM name="frmNewList" onsubmit="return DoImportSpreadsheet();">
   <INPUT type="Text" title="Name" name="List" maxLength="255">
   <INPUT type="File" name="SpreadsheetFile" style="behavior: 
      url(#SpreadsheetLauncherObj);">
   <INPUT type="Hidden" name="ListTemplate" value='SpreadsheetImport'>
   <INPUT type="Submit" value="Import">
   <INPUT type="Hidden" name="Project" value="ows">
   <INPUT type="Hidden" name="Cmd" value="NewList">
</FORM>

Show:
© 2014 Microsoft