Platform SDK: Team Productivity Update |
The FriendlyNameFromGuid method maps the GUID that identifies a specific instance of a team application to the application's friendly name. This method can be used by an application to construct any directory structures the application needs.
[C++] HRESULT FriendlyNameFromGUID( BSTR bstrFactoryID, BSTR* pbstrFriendlyName, ); [Visual Basic] Function FriendlyNameFromGUID(bstrFactoryID As String) As String
For a discussion of sample code that uses the TeamAppManager::GetFriendlyNameFromGUID method, see TeamAppManager Method Calls.
The following code sample handles the Friendly Name button's Click event on the form discussed in Gathering Parameters with a Visual Basic Form. After creating an instance of the TeamAppManager object, the code passes the GUID held in the Text property of the txtFactoryIDResult text box control to the FriendlyNameFromGUID method. This code displays a registered Team Application's friendly name in the txtFriendlyNameResult text box control on a Visual Basic form.
Private Sub cmdFriendlyName_Click() Dim oTK As TeamAppManagerLib.TeamAppManager Dim sFactoryID As String On Error GoTo ErrorHandler ' Create a new instance of the TeamAppManager Set oTK = New TeamAppManagerLib.TeamAppManager ' Get and display the friendly name based on the FactoryID (GUID) txtFriendlyNameResult.Text = oTK.FriendlyNameFromGUID(txtFactoryIDResult.Text) ' Cleanup Set oTK = Nothing Exit Sub ErrorHandler: MsgBox Err.Description End Sub