你能帮我拿出ALM中属于域名的项目列表吗? [英] Could you please help me out to fetch the the list of projects that belong to domain in ALM?

查看:48
本文介绍了你能帮我拿出ALM中属于域名的项目列表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我试图在ALM中列出域的项目的代码片段,我收到以下错误消息



索引属性'ITDConnection11.VisibleProjects'具有必须提供的非可选参数





错误消息显示在此行代码

列出proj = qctd.VisibleProjects; 





我现在很震惊并且不确定如何在这方面取得进展..你能帮帮我吧吗?



我尝试了什么:



使用System; 
使用System.Windows.Forms;
使用MetroFramework.Forms;
使用MetroFramework;
使用TDAPIOLELib;

namespace ALM___Utilities
{
public partial class Form1:MetroForm
{
public Form1()
{
InitializeComponent() ;

}

private void ALM_url_TextChanged(object sender,EventArgs e)
{
if(string.IsNullOrEmpty(ALM_url.Text)& string。 IsNullOrEmpty(Username.Text)& string.IsNullOrEmpty(Password.Text))

loginbutton.Enabled = true;
else
loginbutton.Enabled = false;

}

private void loginbutton_Click(object sender,EventArgs e)
{
string username = Username.Text;
string password = Password.Text;
string URL = ALM_url.Text;
TDConnection qctd = new TDConnection();
qctd.InitConnectionEx(URL);
尝试
{
qctd.Login(用户名,密码);
if(qctd.Connected)
{
MetroMessageBox.Show(this,Logged in Successfully,Login Status,MessageBoxButtons.OK,MessageBoxIcon.Information);
}
列出domainlist = qctd.VisibleDomains;
List proj = qctd.VisibleProjects;
foreach(域名列表中的字符串desc)
{


foreach(项目中的var projname)
{
MetroMessageBox.Show(this, desc.ToString(),domain,MessageBoxButtons.OK,MessageBoxIcon.Information);
// MetroMessageBox.Show(this,projname.ToString(),domain,MessageBoxButtons.OK,MessageBoxIcon.Information);
}

{

}

// MetroMessageBox.Show(this,Project.ToString(),prj,MessageBoxButtons .OK,MessageBoxIcon.Information);
}



}
catch(exception ex)
{
MetroMessageBox.Show(this,ex.Message, 登录状态,MessageBoxButtons.OK,MessageBoxIcon.Error);

}

}
}
}

解决方案

< blockquote>您必须提供域名 - 请参阅文档 VisibleProjects Property [ ^ ]

而不是

 List proj = qctd.VisibleProjects; 
foreach string desc in 域名列表)
{

尝试

 foreach(域名列表中的字符串desc)
{
List proj = qctd .VisibleProjects(desc);


 foreach(域名列表中的字符串desc)
{
List proj = qctd .VisibleProjects [desc];



}



以上代码有效。问题是,我们必须使用方括号而不是paranthesis


The following is the piece of code i have tried to list down the projects for a domain in ALM and i am getting the following error message

Indexed property 'ITDConnection11.VisibleProjects' has non-optional arguments which must be provided



The error message is shown on this line of code

List proj = qctd.VisibleProjects;



I am struck now and not sure how to progress on this.. Could you please help me on this?

What I have tried:

using System;
using System.Windows.Forms;
using MetroFramework.Forms;
using MetroFramework;
using TDAPIOLELib;

namespace ALM___Utilities
{
    public partial class Form1 : MetroForm
    {
        public Form1()
        {
            InitializeComponent();

        }

        private void ALM_url_TextChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(ALM_url.Text) & string.IsNullOrEmpty(Username.Text) & string.IsNullOrEmpty(Password.Text))

                loginbutton.Enabled = true;
            else
                loginbutton.Enabled = false;

        }

        private void loginbutton_Click(object sender, EventArgs e)
        {
            string username = Username.Text;
            string password = Password.Text;
            string URL = ALM_url.Text;
            TDConnection qctd = new TDConnection();
            qctd.InitConnectionEx(URL);
            try
            {
                qctd.Login(username, password);
                if (qctd.Connected)
                {
                    MetroMessageBox.Show(this, "Logged in Successfully", "Login Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                List domainlist = qctd.VisibleDomains;
                List proj = qctd.VisibleProjects;
                foreach (string desc in domainlist)
                {
                    
                       
                   foreach ( var projname in proj)
                    { 
                        MetroMessageBox.Show(this, desc.ToString(), "domain", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //MetroMessageBox.Show(this, projname.ToString(), "domain", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    
                    {
                        
                    }
                        
                        //MetroMessageBox.Show(this, Project.ToString(), "prj", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                


            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, ex.Message, "Login Status", MessageBoxButtons.OK, MessageBoxIcon.Error);

            }

        }
    }
}

解决方案

You have to provide the Domain name - see the documentation VisibleProjects Property[^]
Instead of

List proj = qctd.VisibleProjects;
foreach (string desc in domainlist)
{

try

foreach (string desc in domainlist)
{
    List proj = qctd.VisibleProjects(desc);


foreach (string desc in domainlist)
{
    List proj = qctd.VisibleProjects[desc];


}

The above code worked. The issue was , we have to use square brackets rather than paranthesis


这篇关于你能帮我拿出ALM中属于域名的项目列表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆