SPLongOperation.EndScript method

Informs the server that a lengthy server operation (such as a file transfer) has ended and writes a script to the HTTP output stream.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Sub EndScript ( _
    strScript As String _
)
'Usage
Dim instance As SPLongOperation
Dim strScript As String

instance.EndScript(strScript)
public void EndScript(
    string strScript
)

Parameters

  • strScript
    Type: System.String

    A string that contains the script to write to the HTTP output stream.

Examples

The following code example shows how to start a long operation by using a delegate method, and how to end the operation by executing a script.

SPLongOperation.Begin(
    delegate(SPLongOperation longOperation)
    {
        // Do something that takes a long time to complete.
        
        
        // Inform the server that the work is done
        // and execute a script.
        longOperation.EndScript("window.close();");
    }
);
        ' Do something that takes a long time to complete.
        ' Inform the server that the work is done
        ' and execute a script.
SPLongOperation.Begin(Function(longOperation) AnonymousMethod1(longOperation))

Private Function AnonymousMethod1(ByVal longOperation As SPLongOperation) As Object
    longOperation.EndScript("window.close();")
    Return Nothing
End Function

See also

Reference

SPLongOperation class

SPLongOperation members

Microsoft.SharePoint namespace