Compartir a través de


WorkspaceBrokerAx.LaunchWorkspaceItem method

[LaunchWorkspaceItem is no longer available for use as of Windows 10 and Windows Server 2016 Technical Preview.]

Launches the specified workspace item.

Syntax

workspaceBrokerAx.launchWorkspaceItem(WkspId, WkspFolder, WkspItemName, ActivationContext);

Parameters

  • WkspId [in]
    Type: String

    The workspace identifier obtained from the WorkspaceId property.

  • WkspFolder [in]
    Type: String

    The folder name obtained from the WorkspaceFolderName property.

  • WkspItemName [in]
    Type: String

    The item name obtained from the WorkspaceFolderItemName property.

  • ActivationContext [in]
    Type: String

    Reserved.

Return value

This method does not return a value.

Examples

The following code example, from the RemoteApp and Desktop Connections workspace API sample, shows an example of creating an item link whose click event invokes the LaunchWorkspaceItem method.

function generateWorkspaceItemElement(wkspActiveX, wkspId, folderName, itemIdx) {
    var itemName = wkspActiveX.WorkspaceFolderItemName(wkspId, folderName, itemIdx);
    var itemIcon = wkspActiveX.WorkspaceFolderImageData(wkspId, folderName, itemIdx);
    var itemFileType = wkspActiveX.WorkspaceFolderItemFileExtension(wkspId, folderName, itemIdx);
    var isDesktop = wkspActiveX.IsWorkspaceFolderItemRemoteDesktop(wkspId, folderName, itemIdx);

    // If desired, you can use itemIcon to display an icon image for the resources by generating an HTML tag similar to the following:
    // <img src="data:image/png;base64,contents-of-itemIcon-variable" />

    // If desired, you can distinguish between resources types (e.g. ".rdp" vs. 3rd party file types) by examining the itemFileType variable

    // If desired, you can seperate Desktop from Non-Desktop (e.g. RemoteApp) resources by filtering on the isDesktop variable

    var resourceLinkTag = document.createElement("a");
    resourceLinkTag.textContent = itemName;
    resourceLinkTag.addEventListener("click", function () {
        try {
            wkspActiveX.LaunchWorkspaceItem(wkspId, folderName, itemName, "sample activation context");
        } catch (e) {
            WinJS.log && WinJS.log("Error launching workspace item: " + e.number + " " + e.message, "sample", "error");
        }
    }, false);

    var listItemTag = document.createElement("li");
    listItemTag.appendChild(resourceLinkTag);

    return listItemTag;   
}

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

End of client support

Windows 8.1

End of server support

Windows Server 2012 R2

IDL

Wkspbkax.idl

See also

WorkspaceBrokerAx