Local variables in C#

priestxandar

Client
Регистрация
28.08.2012
Сообщения
35
Благодарностей
1
Баллы
8
How can i use local variables from the template in c# action:

Example:
// download all messages from gmail via IMAP
Tuple<string, string, string, string>[] allMails;
allMails = ZennoPoster.BulkMailDownload("[email protected]",
"Wang83pass", "imap.gmail.com", 993, true,
ZennoLab.InterfacesLibrary.Enums.Email.EmailProtocol.IMAP,
48*100, 1000, true);


In this way they are hard coded, i need to use local variables instead.


Thanks.
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
831
Баллы
113
Use project.Variables["varName"].Value where varName is local variable name
 
  • Спасибо
Реакции: roadhog

roadhog

Client
Регистрация
29.07.2011
Сообщения
76
Благодарностей
4
Баллы
8
This doesn't seem to be working for me. I'm on ver. 4.3.7.1 xp sp3
The variables are loaded up using a table. I checked to make sure the variable were working fine and they are.
The error I get is - Sequence contains no matching element
log file is attached

Here is the code I am using -

Tuple<string, string, string, string>[] allMails;
allMails = ZennoPoster.BulkMailDownload(project.Variables["{-Variable.email-}"].value,
project.Variables["{-Variable.password-}"].Value, "pop.secureserver.net", 110, false,
ZennoLab.InterfacesLibrary.Enums.Email.EmailProtocol.POP3,
24*100, 20, false);

// loop fo all messages
foreach(Tuple<string, string, string, string> tuple in allMails)
{
// adding messages to the table called Tabl1
// tuple.Item1 - sibject, tuple.Item2 - from, tuple.Item3 - html message, tuple.Item4 - text message
List<string> tmp = new List<string>();
tmp.Add(tuple.Item1);
tmp.Add(tuple.Item2);
tmp.Add(tuple.Item3);
tmp.Add(tuple.Item4);
project.Tables["Tabl1"].AddRow(tmp);
}
 

Вложения

roadhog

Client
Регистрация
29.07.2011
Сообщения
76
Благодарностей
4
Баллы
8
oops, never mind I got it, variable name not the variable itself.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)