Quantcast
Channel: All Quality Center / ALM Practitioners Forum posts
Viewing all articles
Browse latest Browse all 14708

Re: OTA code to check if a project is linked to project template

$
0
0

Hi Chandra,

 

GetLinkedProjects Method in the SiteAdministration API help file will suffice your need. 

This Method will return a String which will be in the form of XML data. 

We need to parse this XML data for the Value <PROJECT_NAME>. 

Say for example Your_Template exists in the domain Your_Domain in the Site Administration. 

Below code will return all the projects which are linked to Your_Template of Your_Domain

I used Your_Domain as "DEFAULT" and Your_Template as "eApprove_V30119". 

You may need to further enhance the below code as per your business requirement.

In the below else block you may need to check whether the returned project value is equal to project present in your list , if it is equal then set flag to True corresponding to that project or else set flag to False.

 

Else
                Console.WriteLine(ProjectName)
End If

 Sample Code:

 

Imports SACLIENTLib
Imports System.Xml
Imports System.IO
Module Module1
    Sub Main()
        Dim objSAClient
        Dim Project_Names As String
        objSAClient = CreateObject("SAClient.SaApi.9")
        objSAClient.login("http://Your_Server_Name:8080/qcbin", "Your_User_ID", "Your_Password")
        Console.WriteLine("Connected to the Site Administration..")
        Project_Names = objSAClient.GetLinkedProjects("DEFAULT", "eApprove_V30119", "template")
        'Console.WriteLine("Project Details are" + Project_Names)
        Dim stream As StringReader
        Dim reader As XmlTextReader = Nothing
        Dim ProjectName As String = Nothing
        Dim Temp = Nothing
        stream = New StringReader(Project_Names)
        reader = New XmlTextReader(stream)
        While reader.Read()
            If (reader.IsStartElement("PROJECT_NAME")) Then ProjectName = reader.ReadElementString
            If ProjectName = Temp Then
                Continue While
            Else
                Console.WriteLine(ProjectName)
            End If
            Temp = ProjectName
        End While
        reader.Close()
        Console.ReadLine()
    End Sub
End Module

 Regards,

 Srihari


Viewing all articles
Browse latest Browse all 14708

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>