|
Here's an example that recurses your outlook folder structure, looking for a named folder
using Microsoft.Office.Interop.Outlook;
...
Microsoft.Office.Interop.Outlook.Application outlook = new Microsoft.Office.Interop.Outlook.Application();
private Folder FindFolderRecursive(Folders start, string name)
{
foreach (Folder folder in start)
{
if (folder.Name == name)
{
return folder;
}
Folder found = FindFolderRecursive(folder.Folders, name);
if (found != null)
{
return found;
}
}
return null;
}
private void Form1_Shown(object sender, EventArgs e)
{
Folder stuff = FindFolderRecursive(outlook.Session.Folders, "Stuff")
foreach(Mailitem item in stuff.Items)
{
}
}
|
|
|
|
|
Thank you,
Please give me any link that fetch the email from a folder.
Or tell me how to do?
|
|
|
|
|
Erm - that's exactly what the snippet I posted does - it searches for a named folder then loops through all the mails in it.
|
|
|
|
|
|
Hi,
Whenever I tried to sort the mail item, it does not effect.
Microsoft.Office.Interop.Outlook.MAPIFolder mItem = TraverseTee(outlook.Session.Folders, "myfolder");
if(mItem!=null)
{
mItem.Items.Sort("Received", false);
int i=0;
foreach(Microsoft.Office.Interop.Outlook.MailItem item in mItem.Items)
{
listBox1.Items.Insert(i,item.Subject);
i++;
}
}
|
|
|
|
|
Is there a way to get the variable name in runtime ?
for example:
int number1=1;
int number2=2;
System.Console.WriteLine( PrintNameOfVariable(number1) );
System.Console.WriteLine( PrintNameOfVariable(number2) );
will write :
<br />
number1<br />
number2<br />
|
|
|
|
|
easy...
System.Console.WriteLine("number1");
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi,
I meant that im searching for a way to get the variable name.
For example if i have an object:
object aaa1 = somthig();
I want to get in runtime the variable name, in this case a string that conatin the value "aaa1".
|
|
|
|
|
some of these link[^]s may help
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
bonzaiholding wrote: Is there a way to get the variable name in runtime ?
AFAIK, not for local variables. You can use reflection to check what a class exposes, but you cannot see the names of locals.
|
|
|
|
|
I agree.
You can see the method parameters though, which basically are locals; they probably included those for supporting interface documentation.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
This is from CHandra
My Questions in How can i get AutoGenerate alpha numerics with combination of strings and Numbers.
Can any give me some suggestion on or any code is there in C# please send me
Thanks and Regards
Chandrakanth
|
|
|
|
|
Guid.NewGuid().ToString("N");
|
|
|
|
|
How about...
string GetRandomString(int length)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(length);
Random rnd = new Random();
for(int i = 0; i < length; i++)
{
sb.Append((char)rnd.Next(33, 127));
}
return sb.ToString();
}
Life goes very fast. Tomorrow, today is already yesterday.
modified on Wednesday, July 15, 2009 9:08 AM
|
|
|
|
|
musefan wrote: System.Text.StringBuilder sb = new System.Text.StringBuilder(length);
ftfy.
I improved the performance a bit.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi.
this is my coding
string MyString;
MyString = "Select * from timemgmt";
if (radioin.Checked == true)
{
cn = new OdbcConnection("Driver={Microsoft ODBC for Oracle};Server=orcl;UID=it;PWD=cr;");
cmd = new OdbcCommand(MyString, cn);
cn.Open();
cmd.CommandText = "insert into timemgmt values('" + textBox1.Text + "','" + label19.Text + "','" + label18.Text + "','" + label18.Text + "')";
cmd.ExecuteNonQuery();
cn.Close();
textbox1.text = employe ID
label19.text = System Date
label18.text = System Time
i want to do Accept employee ID in one time in a day 2nd time user give same Id in a same date not accepted
plzz give me some hints
thanks in Advance
Jawad Khatri
|
|
|
|
|
0) 'hi' = bad subject
1)
mjawadkhatri wrote: cmd.CommandText = "insert into timemgmt values('" + textBox1.Text + "','" + label19.Text + "','" + label18.Text + "','" + label18.Text + "')";
Use parameters (odbcparameter). (read up on sql-injunctions)
2) use the 'code block' tags to post code
3) Your question: One way to do it would be to do a select from the user + date first. If the select returns 0 rows --> insert else --> don't insert
|
|
|
|
|
I can't think of any more hints, those are the ones I would have given also.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
You could try recommending a book, not the one that book stores want you to buy thou
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Nah. I only do that when a very basic question is getting asked; anyway, feel free to visit a decent book store, I could recommend the Stanford University Bookstore on the Palo Alto campus, it is quite impressive (I think it looks like an Amazon warehouse).
FYI: I added a book thread[^] on my personal CP blog for your convenience.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
That's a bit far for me, but thanks none the less. I went to a book store the other day and could not even find a computer section! I'll try a different one next time...
Some good advise in your thread
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
musefan wrote: That's a bit far for me
Same here, but I do visit it on every opportunity, which is once in ten years or so.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Well I shall keep it in mind if I am ever in the area
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Well for once I was first
|
|
|
|
|
I love when they post code that is a disaster, we try to help, and they never answer anyone who replies.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|