TaskLauncher.EnsureTaskApplication Method

Applies to: SharePoint Foundation 2010

Returns the application name that is used by the TaskLauncher control.

EnsureTaskApplication()

Return Value

Type: String

The application name (for example, "Microsoft Project").

Example

The following example tests for the presence of the TaskLauncher control and records the result in a document cookie.

// Global variable for the TaskLauncher control.
var g_objProjectTaskLaunch=null;

// Instantiate the control if it is present.
// Return the application name if it is and empty string if it is not.
function GetProjectTaskLaunchInstalled()
{
    if(document.cookie.indexOf("projInstalled") == -1)
    {
        var strAppName = '';
        try
        {
            g_objProjectTaskLaunch = new ActiveXObject("TaskLaunch.TaskLauncher");
            strAppName = g_objProjectTaskLaunch.EnsureTaskApplication();
            document.cookie = "projInstalled="+ strAppName+";";
        }
        catch (e)
        {
            // Could not instantiate the new ProjectTaskLauncher.
            document.cookie = "projInstalled=0;";
            g_objProjectTaskLaunch = null;
        }
    }
    else
    {
        strAppName = GetCookie("projInstalled");
        if(strAppName == '0')
            strAppName = '';
    }
    return strAppName;
}