Tag: 附加

更改outlook mailitem选择c#

我想从outlook加载项中选择一个mailItem。 我知道如何从c#显示mailitem,但我需要在outlook窗口中选择它。 显示mailitem: mailItem.Display(); 我正在使用Outlook 2010加载项。 任何人都知道如何做到这一点?

该进程无法访问该文件,因为它正由另一个进程使用(文件已创建但不包含任何内容)

using System.IO; class test { public static void Main() { string path=@”c:\mytext.txt”; if(File.Exists(path)) { File.Delete(path); } FileStream fs=new FileStream(path,FileMode.OpenOrCreate); StreamWriter str=new StreamWriter(fs); str.BaseStream.Seek(0,SeekOrigin.End); str.Write(“mytext.txt…………………….”); str.WriteLine(DateTime.Now.ToLongTimeString()+” “+DateTime.Now.ToLongDateString()); string addtext=”this line is added”+Environment.NewLine; File.AppendAllText(path,addtext); //Exception occurrs ?????????? string readtext=File.ReadAllText(path); Console.WriteLine(readtext); str.Flush(); str.Close(); Console.ReadKey(); //System.IO.IOException: The process cannot access the file ‘c:\mytext.txt’ because it is //being used by […]