|
Thanks for your help,
I had already visited that and tried below
Outlook._Application olApp = new Outlook.ApplicationClass();
Outlook._NameSpace olNS = olApp.GetNamespace("MAPI");Outlook._Folders oFolders;
oFolders = olNS.Folders;
Outlook.MAPIFolder oPublicFolder = oFolders.Item("Public Folders");
oFolders = oPublicFolder.Folders;
Outlook.MAPIFolder oAllPFolder = oFolders.Item("All Public Folders");
oFolders = oAllPFolder.Folders;
Outlook.MAPIFolder oMyFolder = oFolders.Item("My Public Folder");
Console.Write(oMyFolder.Name);
But it is not working giving an error at oFolders.Item("Public Folders");
|
|
|
|
|
Cut and paste from the page linked above.
"
Folders object -
You can use the Folders object to refer to any folder that is in the Outlook folder list. The Folders object is typically used to refer to a Microsoft Exchange folder or to any other folder that is not a default Outlook folder.
The following sample code illustrates how to refer to a public folder that is named My Public Folder. Notice that you typically start at the top-most folder and then work your way down to the folder that you have to reference. Also notice that the folder names are case-sensitive. You must exactly match the capitalization and the names as they appear in the Outlook folders list.
"
I'd double check this.
Just because we can; does not mean we should.
|
|
|
|
|
I read that but I got error before that and am yet to reach there.
Outlook._Application olApp = new Outlook.ApplicationClass();
Outlook._NameSpace olNS = olApp.GetNamespace("MAPI");Outlook._Folders oFolders;
oFolders = olNS.Folders;
Outlook.MAPIFolder oPublicFolder = oFolders.Item();
oFolders.Item is not defined thats what it says me.
|
|
|
|
|
Lets assume I have a folder named "SPAM".
I'd write that line like:
Outlook.MAPIFolder oPublicFolder = oFolders.Item("SPAM");
Maybe I'm not understanding you correctly....If thats the case, I'll leave it to someone else.
Just because we can; does not mean we should.
|
|
|
|
|
You are almost there!
What i mean is when we write
Outlook.MAPIFolder oPublicFolder = oFolders.Item("SPAM");
when i write oFolders and press ".", i don't see "Item", means oFolders doesn't have a definition of "Item" and it throws me error there itself. Specifing the folder name "SPAM" will be checked in the next step.
Hope you are getting me now.
Appreciate and Thanks a million to you!
|
|
|
|
|
OK, I get you now.
Try this out and see what you get for folder names or just refer to the folder by index.
<br />
Microsoft.Office.Interop.Outlook._Application olApp = new Microsoft.Office.Interop.Outlook.ApplicationClass();<br />
Microsoft.Office.Interop.Outlook._NameSpace olNS = olApp.GetNamespace("MAPI"); <br />
Microsoft.Office.Interop.Outlook._Folders oFolders;<br />
oFolders = olNS.Folders;<br />
<br />
for (int i = 0; i < oFolders.Count; i++)<br />
{<br />
Microsoft.Office.Interop.Outlook.MAPIFolder oPublicFolder = oFolders[i].;<br />
Console.Write(oPublicFolder.Name);<br />
}<br />
Just because we can; does not mean we should.
|
|
|
|
|
Thanks for that, but it gave me out of index error, but i just twisted your code somewhat and this is what i did and got the folder details i need.
Outlook.Application OApp = new Outlook.ApplicationClass();
Outlook.NameSpace ns = OApp.GetNamespace("MAPI");
Outlook.MAPIFolder inbxfld = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.MAPIFolder prsnlfldr = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
Outlook.Folders pfldr = ns.Folders;
Console.WriteLine(pfldr.Count);
foreach(Outlook.MAPIFolder fld in pfldr)
{
Console.WriteLine(fld.Name);
}
Thanks a million for your help and getting me out of this
Now I am going a step further!
Btw, liked your line "Just because we can; does not mean we should."
|
|
|
|
|
I am trying to create a method where if a user clicks on the checkbox of a treeview node it deletes it only if it is a childnode but does not delete it if it is a rootfolder. This is how I started. If anybody can give me a clue and show me how to make it work? Thanks.
private bool CheckBox(TreeNode tn)
{
if (tvFavorites.SelectedNode.Checked == true)
{
//tn.Nodes.Remove();
tvFavorites.SelectedNode.Remove();
}
else
{
return CheckBox(false); and here I get an error that "Best overloaded method: invalid argument.
}
}
modified on Friday, December 28, 2007 2:36:51 PM
|
|
|
|
|
A) To solve your problem, check to see if the selected node is a child node and perform your actions accordingly.
B) Your error; You are calling the function CheckBox passing the variable of type bool when its expecting type TreeNode. To solve, simple replace that line with "return false;"
Just because we can; does not mean we should.
|
|
|
|
|
private bool CheckBox(TreeNode tn) //but then I got an error here which says "not all paths return a value". So, what should I do now??
{
//if (tn.Checked == true)
if (tvFavorites.SelectedNode.Checked == false) //
{
//tn.Nodes.Remove(true);
tvFavorites.SelectedNode.Remove(); //
}
else
{
return false; // I modified my code here as per your suggestion
}
}
|
|
|
|
|
I'd recommend reading up on returning values from a function, google can help you there.
<br />
private bool CheckBox(TreeNode tn)
{<br />
if (tvFavorites.SelectedNode.Checked == false)
{<br />
tvFavorites.SelectedNode.Remove();
<br />
return true;
}<br />
else<br />
{<br />
return false;
}<br />
<br />
}
Just because we can; does not mean we should.
|
|
|
|
|
Thank You for the return true; statement. Atleast I dont get that error now. But I am trying to find out how to make the checkbox delete the childnode and not the root node.
That private bool CheckBox(TreeNode tn) does not get executed
|
|
|
|
|
Your function CheckBox(TreeNode tn) returns a type of boolean.
Are you doing anything with that return value?
In your checkbox checked event are you telling it to run CheckBox?
Is this the path your code is taking?
user clicks check box
->checkbox event triggers
-->checks to see if its a child node; if so
-->CheckBox code is run (removing the treenode) return true if successful, else false
Hope this helps you get back on track.
Edited to add:
To check if a treenode is the root node, check the Level property.
if(TreeViewNode.Level == 0)<br />
{<br />
....<br />
}<br />
else<br />
{...}
Just because we can; does not mean we should.
|
|
|
|
|
if(TreeViewNode.Level == 0)
{
tn.Nodes == true; //here i want to enter a code which will tell me that it is a root node. How should I put that code here it gives me an error "Operator == cannot be applied to bool"
}
else
{
tn.Nodes.Remove(false); //"here it gives me an error "Best overloaded method:has some invalid arguments"
}
|
|
|
|
|
Ok lets see here.
if(TreeViewNode.Level == 0)
{
//you know this is a root node(because the level is equal to zero, the first level of nodes!) so do not do anything!
}
else
{
//this is a child node so lets remove it.
}
<br />
private bool CheckBox(TreeNode tn)<br />
{<br />
if (tn.Checked == false)<br />
{<br />
if(tn.Level != 0)<br />
{<br />
tn.Remove();<br />
<br />
return true;<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
}<br />
use this function like this
<br />
if(CheckBox(tvFavorites.SelectedNode) == true)<br />
MessageBox.Show("It was removed.");<br />
else<br />
MessageBox.Show("Its still there.");<br />
Good Luck.
Just because we can; does not mean we should.
|
|
|
|
|
Hi all,
I posted this on the .NET Framework board about a week ago and got no response, so I thought I'd try here.
I'm developing an application in which I bind to XmlDataProvider.Source property. If the xml file I'm binding to has an extension of .xml everything is fine. If it has some other extension the binding fails.
I posted on forums.microsoft.com and was given instruction to go to the Connect website and log this as a bug. Maybe I'm stupid, but I cannot figure out how to do that.
I'm posting the link to my post on the forums. I hope that doesn't violate any forum posting "codes of conduct".
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2538606&SiteID=1&mode=1[^]
If anyone has any advice, suggestion, or knowledge about this problem I would love to hear it.
Thanks.
Lily Bristol
|
|
|
|
|
You can embed inline XML, Use a Uri or an XmlDocument
Which one are you using?
You could do the following, but I'm sure there is a better way.
<br />
WebClient wc = new WebClient();<br />
byte[] data = wc.DownloadData("http://.......");<br />
wc.Dispose();<br />
string source = System.Text.ASCIIEncoding.ASCII.GetString(data);<br />
<br />
XmlDataProvider.Source = source;
<br />
Just because we can; does not mean we should.
|
|
|
|
|
Hi,
Thanks for the response. Just getting back to work after Holiday break.
If you follow the link found in my original message (for some reason it is not clickable, but if you cut-and-paste into a browser it should work) it shows the code I'm using. In a nutshell, I'm trying to assign a new URI to an XML file. If the file (specialXmlFile in my example) has a .xml extenstion all is well. If it doesn't the binding does not take.
Lily Bristol
|
|
|
|
|
Hello
I have create a form (assume form1)this form has a name and password fields , I have another form (assume form2) it`s have a password changer
like
password :
confirm a new password :
by those fields I must change the password field in form1
please can anyone help me
<<<<<<<<<<<<<<<<<<<<<<<<<<<Best wishes>>>>>>>>>>>>>>>>>>>>>>>>>>
|
|
|
|
|
You'll need to store a "reference" to both forms somewhere so you can access both of them. Or alternatively store the password in a commmon location.
Here's a simple example (don't follow it for security reasons):
public class DataStore
{
public static string Password { get; set; }
}
public class Form1 : Form
{
private void txtPassword_TextChanged(object sender, EventArgs e)
{
DataStore.Password = this.txtPassword.Text;
}
}
public class Form2 : Form
{
private void ChangePassword(string newPassword)
{
DataStore.Password = newPassword;
}
}
|
|
|
|
|
Hello
Thanks for your answer but what can I write in class datastore (exactly in get & set)
<<<<<<THANKS A LOT>>>>>>
|
|
|
|
|
johnIT86 wrote: (exactly in get & set)
Those are automatic properties which require C# 3.0. You could write them as such:
public class DataStore
{
private static string m_Password;
public static string Password
{
get { return DataStore.m_Password; }
set { DataStore.m_Password = value; }
}
}
|
|
|
|
|
Not the best architecture seen so far.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Why do you need to change the password in form1? You should not be displaying passwords, only asking the user to input. Change the password in form2, then go back to form1 as normal.
only two letters away from being an asset
|
|
|
|
|
Can anyone recommend a component, close or open-source (no GPL please), that has a decent editor to be embedded into an app?
Cheers
modified on Friday, December 28, 2007 3:33:32 PM
|
|
|
|