## XSIApplication.AddWorkgroup

### Introduced

v5.0

### Description

Adds a new workgroup and loads any plug-ins found in the workgroup. This function does nothing if the workgroup is already part of the workgroup list. Softimage will remember the new workgroup as part of the user Preferences.

### C# Syntax

    XSIApplication.AddWorkgroup( String in_workgrouppath );

### Scripting Syntax

    XSIApplication.AddWorkgroup( WorkgroupPath );

### Parameters

Parameter | Type | Description
--- | --- | ---
WorkgroupPath | String | Complete path to root directory of a workgroup.

### Examples

#### JScript Example

    /*
            This example demonstrates how to ask the user for the path to a workgroup and
            to connect to it.  It uses the XSIApplication.Workgroups property to discover if
            the workgroup already exists
    */
    AddWorkgroupWithUI() ;
    function AddWorkgroupWithUI()
    {
            var strTitle = "Connect to Workgroup" ;
            var strHelpText = "Pick the root location of an existing workgroup" ;
            var strDefault = "" ;
            var strPath = PickFolder( strTitle, strHelpText, strDefault ) ;
            if ( strPath != "" ) {
                    aWorkgroups = new VBArray( Application.Workgroups ) ;
                    cntWorkgroups = aWorkgroups.ubound( 1 ) + 1
                    for ( var i=0 ; i<cntWorkgroups; i++ ) {
                            var existingWorkgroup = aWorkgroups.getItem( i ) ;
                            if ( existingWorkgroup == strPath ) {
                                    XSIUIToolkit.MsgBox( "This workgroup is already in the list" ) ;
                                    return ;
                            }
                    }
                    try {
                            Application.AddWorkgroup( strPath ) ;
                    } catch( e ) {
                            // Maybe the path isn't valid
                            XSIUIToolkit.MsgBox( "Failed to addworkgroup\n" + e.description ) ;
                    }
            }
    }

### See Also

XSIApplication.RemoveWorkgroup XSIApplication.Workgroups XSIApplication.RescanWorkgroups XSIApplication.ActivateWorkgroup