سؤال

I tried doing that by various methods but an exception pop-ups. My lync silverlight application works fine in browser or out of browser (with elevated permissions) but when I try to do so in lync's window extension (CWE) it throws an exception saying "File operation not permitted. Access to path '' is denied". Please help!

private void button1_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            if (!string.IsNullOrEmpty(textBox1.Text))
            {
                string path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "abc.txt");

                StreamWriter writer = File.CreateText(path);
                writer.Write(textBox1.Text);
                writer.Close();
            }
        }
        catch (Exception ee)
        {
            MessageBox.Show(ee.Data + "\n\n" + ee.Message);
        }
    }
هل كانت مفيدة؟

المحلول

Saving to file via silverlight has always been limited for security reasons, if you want to save without prompting the user I suggest using IsolatedStorage. See the MSDN documentation for more details http://msdn.microsoft.com/en-us/library/cc265154(v=vs.95).aspx

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top