Attribute VB_Name = "Favorites" Option Explicit Dim errmsg$ ' #Region "PrintDefectsFavoritesByFolderName" Sub PrintDefectsFavoritesByFolderName(defectsFolderName As String) ' Output all the names of the Defect Module Favorites under a folder Dim objFavoriteFolderFactory As TDAPIOLELib.FavoriteFolderFactory Dim objFavoriteFolderFilter As TDAPIOLELib.TDFilter Dim favoriteFolderList As TDAPIOLELib.List Dim defectsFavoriteFolder As TDAPIOLELib.FavoriteFolder ' Get the defects module favorite folder. Set objFavoriteFolderFactory = TDConnection.GetCommonFavoriteFolderFactory Set objFavoriteFolderFilter = objFavoriteFolderFactory.Filter objFavoriteFolderFilter.Filter("FF_NAME") = defectsFolderName Set favoriteFolderList = objFavoriteFolderFilter.NewList() Set defectsFavoriteFolder = favoriteFolderList.Item(1) ' Print the tree for the defects module favorites tree. PrintFavorites defectsFavoriteFolder End Sub '############################################################ Public Sub PrintFavorites (parentFavoriteFolder As TDAPIOLELib.FavoriteFolder) ' Output all the names of the Favorites under a folder Dim objFavoriteFactory As TDAPIOLELib.FavoriteFactory Dim favoriteList As TDAPIOLELib.List Dim objFavorite As TDAPIOLELib.Favorite Dim objFavoriteFolderFactory As TDAPIOLELib.FavoriteFolderFactory Dim favoriteFolderList As TDAPIOLELib.List Dim objFavoriteFolder As TDAPIOLELib.FavoriteFolder ' Print parent name. Debug.Print ("Favorite Folder: " + parentFavoriteFolder.name) ' Get list of child favorites. Set objFavoriteFactory = parentFavoriteFolder.FavoriteFactory Set favoriteList = objFavoriteFactory.NewList("") ' Print child favorites. For Each objFavorite In favoriteList Debug.Print ("Favorite:" + objFavorite.name) Next ' Get list of child favorite folders. Set objFavoriteFolderFactory = parentFavoriteFolder.FavoriteFolderFactory Set favoriteFolderList = objFavoriteFolderFactory.NewList("") ' Print child favorite folders. For Each objFavoriteFolder In favoriteFolderList PrintFavorites objFavoriteFolder Next End Sub ' #End Region ' #Region "GetSettings" Public Sub GetSettings() ' Get the Property for a specific field Dim aSet As Settings Dim setItems As List Dim aSetItem Dim ItemName As String Dim aField As TDField Dim fieldList As List '------------------------------------------------ ' Get the Settings object for the logged-on user ' with TDConnection.UserSettings. 'tdc is the global TDConnection object. Set aSet = tdc.UserSettings ' Get the list of all setting items. Set setItems = aSet.EnumItems ' Print the list of all setting items. For Each aSetItem In setItems ItemName = aSetItem Debug.Print aSetItem Debug.Print "-----------------------" Debug.Print aSet.value(ItemName) Debug.Print "=======================" Next aSetItem '------------------------------------------------ ' Use TDConnection.Fields to get the user fields. ' As we see above, there is a "not PDF" ' condition for field "BG_USER_29" in the private ' favorite view. Check how the user field is used. ' The result is "BG_USER_29 To_Meeting" ' Set fieldList = tdc.Fields("BUG") For Each aField In fieldList If aField.name = "BG_USER_29" Then Debug.Print aField.name, aField.Property Exit For End If Next aField '------------------------------------------------ 'OUTPUT: '* The first setting item output is the grid setup for the user. '* The user views open defects assigned to user "steves" '* Note that this setting has no name. ' ----------------------- ' { ' grid: "1,0;64,BG_BUG_ID;64,BG_STATUS;64,BG_PRIORITY;64,BG_RESPONSIBLE;460,BG_SUMMARY;", ' filter: "[Filter]{ ' TableName:BUG, ' ColumnName:BG_PRIORITY, ' SortOrder:1, ' SortDirection:0, ' NO_CASE: ' } ' { ' TableName:BUG, ' ColumnName:BG_RESPONSIBLE, ' LogicalFilter:steves, ' VisualFilter:\" steves \", ' NO_CASE: ' } ' { ' TableName:BUG, ' ColumnName:BG_STATUS, ' LogicalFilter:\"New Or Open Or Reopen\", ' VisualFilter:\" New Or Open Or Reopen \", ' NO_CASE: ' } ' ", ' show_rdcomment: "y", ' show_description: "y" ' } '******************************************************************** '*** The second setting item output is a private Favorite view called '*** "QC_Open_for_Steves" '*** The Favorite is the same as the view above, but excludes items '*** with a value of "PDF" in user field BG_USER_29 ' ======================= ' QC_Open_for_Steves ' ----------------------- ' { ' grid: "1,0;64,BG_BUG_ID;64,BG_STATUS;64,BG_PRIORITY;64,BG_RESPONSIBLE;460,BG_SUMMARY;", ' filter: "[Filter]{ ' TableName:BUG, ' ColumnName:BG_PRIORITY, ' SortOrder:1, ' SortDirection:0, ' NO_CASE: ' } ' { ' TableName:BUG, ' ColumnName:BG_RESPONSIBLE, ' LogicalFilter:steves, ' VisualFilter:\" steves \", ' NO_CASE: ' } ' { ' TableName:BUG, ' ColumnName:BG_STATUS, ' LogicalFilter:\"New Or Open Or Reopen\", ' VisualFilter:\" New Or Open Or Reopen \", ' NO_CASE: ' } ' { ' TableName:BUG, ' ColumnName:BG_USER_29, ' LogicalFilter:\"not \\\"PDF\\\"\", ' VisualFilter:\"not \\\"PDF\\\"\", ' NO_CASE: ' } ' " ' } ' End Sub ' #End Region