How can the folder path of a console object be retrieved in NS 7?
Created: 01 Oct 2009
In NS6 there was a function called "GetItemPath" in which return the path for an object in the Console. How can I get the folder path in NS 7?
"GetItemPath" function does not exist in the NS 7 database. Here is the sql behind creating that function for changes in the NS 7 database:
USE [Symantec_CMDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[GetItemPath]
(
@Guid Varchar(40)
)
Returns varchar(8000)
AS
Begin
DECLARE
@SearchGuid VARCHAR(40),
@ItemPath VARCHAR(500),
@ExitCounter INT
SET @SearchGuid = @Guid
SET @ItemPath = ''
SET @ExitCounter = 0
WHILE @ExitCounter = 0
BEGIN
IF EXISTS (SELECT * FROM ItemFolder WHERE ItemGuid = @SearchGuid AND ParentFolderGuid != 'D0E33520-C160-11D2-8612-00104B74A9DF')
BEGIN
SET @ItemPath = (SELECT TOP 1 [Name] + '/' FROM Item WHERE [Name] NOT LIKE '/_%' escape '/' and Guid =
(SELECT TOP 1 ParentFolderGuid FROM ItemFolder WHERE ItemGuid = @SearchGuid)
) + @ItemPath
SET @SearchGuid = (SELECT TOP 1 ParentFolderGuid FROM ItemFolder WHERE ItemGuid = @SearchGuid)
END
ELSE
BEGIN
SET @ExitCounter = 1
END
END
RETURN @ItemPath
END
Usage of this function:
SELECT [Symantec_CMDB].[dbo].[GetItemPath] ('GUID')
Where GUID is the guid of your object.
Blog Entry Filed Under:
The Endpoint Management Community Blog is the perfect place to share short, timely insights including product tips, news and other information relevant to the Endpoint Management community. Any authenticated Connect member can contribute to this blog.