OpenXMLDocuments.EditDocument2 Method

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Opens the specified XML document or form for editing within its associated application based on the specified instance of Internet Explorer.

expression.EditDocument2(pdisp, bstrDocumentLocation, bstrDocumentID)

Parameters

expression

An expression that returns an OpenXMLDocuments Control object.

pdisp

An Object representing a pointer to the Internet Explorer instance that is calling the EditDocument2 method. Using a null value for this argument results in the method being executed on the primary Internet Explorer thread. As an alternative, you can use the EditDocument method if you do not need to pass an object with this argument.

bstrDocumentLocation

A string that contains the URL of the location of the XML document or form to open for editing.

bstrDocumentID

A string that contains the ProgID of the application, stored in Windows SharePoint Services as promoted from the XML file. It is used by the launch application (for example, inlaunch.dll) to determine the application—used to edit the XML document or form—to pass the command into. Recommended usage is to use the ProgID property set through XML property promotion in the properties.xfp file.

Return Value

true if the XML document or form successfully opens; otherwise false.

Example

The following example opens an XML document or form for editing whose location and program ID are specified by the values for the strDocLoc and varProgID variables that are passed to the EditDocument2 method. The example assumes the existence of a form named frmEditDoc that has two input boxes, DocLocation and DocProgID.

<script language="JavaScript">
function editXMLDocument()
{
   // Create an instance of the OpenXMLDocuments object.
   xmlDocObject = new ActiveXObject("SharePoint.OpenXMLDocuments.1");

   // If the OpenXMLDocuments object was successfully created,
   // get the document location and document program ID values
   // from the form's input boxes.
   if (xmlDocObject)
   {
      var strDocLoc = document.frmEditDoc.DocLocation.value;
      var varProgID = document.frmEditDoc.DocProgID.value;

      // Open the XML document or form for editing.
      xmlDocObject.EditDocument2(window, strDocLoc, varProgID);
   }
}
</script>

See Also

Reference

OpenXMLDocuments Control

OpenXMLDocuments Members