Email Isolated Storage File

  • Thread starter Thread starter Chuck P
  • Start date Start date
C

Chuck P

How can I email an isolated storage file.

I don't believe I can do new Atttachment(fileName)
because I don't have access to the isolated storage path
But this is what I would really like to do.


I am having real trouble doing
new
Atttachment(System.IO.IsolatedStorage.IsolatedStorageFileStream,"");
because I have a threaded class for sending emails and trying to pass
in an attachment where the filestream is still open is very
problematic.
 
Hello,

To Access an IsolatedStorageFile, we can use following code:

IsolatedStorageFile isoFile =
IsolatedStorageFile.GetStore(IsolatedStorageScope.User |
IsolatedStorageScope.Assembly |
IsolatedStorageScope.Domain,
null,
null);

IsolatedStorageFileStream isoStream =
new IsolatedStorageFileStream(this.userName,
FileMode.Open,
FileAccess.Read,
FileShare.Read);

try
{

SafeFileHandle aFileHandle = isoStream.SafeFileHandle;
Console.WriteLine("A pointer to a file handle has been
obtained. "
+ aFileHandle.ToString() + " "
+ aFileHandle.GetHashCode());
}

catch (Exception e)
{
// Handle the exception.
Console.WriteLine("Expected exception");
Console.WriteLine(e);
}

StreamReader reader = new StreamReader(isoStream);

To send it as an email attachment, we may first write it to disk as a
temporary file, or use the IsolatedStorageFileStream directly. Is there any
trouble in the actual of your project, for security issue?

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
No security problems writing as long as the writing/reading is done to
the user's isolated storage. I know how to read/write isolated
storage. But I don't know how to add an isolated storage file(s) to
an email as an attachment. I can't use SafeFileHandle becuase it is
not allowed to access IsolatedStorage.


I don't believe I can do or message.Attachments.Add(new
Atttachment(fileName))
because I don't have access to the isolated storage path
But this is what I would really like to do.

I am having real trouble doing
new

message.Attachments.Add(newAtttachment(System.IO.IsolatedStorage.IsolatedStorageFileStream,"filename");
because I have a threaded class for sending emails and trying to pass
in an attachment where the filestream is still open is very
problematic. (Error can not access a closed file or file is being
used by another process, if file is open)
 
Hello,

You may perform a test in the thread code, not create mail attachment, just
read the IsolatedStorageFile and write th binary data to a local file, will
this also generate the error (can not access a closed file)?

Sincerely,

Luke Zhang

Microsoft Online Community Support
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello,

That is strange since you have mentioned "No security problems writing as
long as the writing/reading is done to the user's isolated storage. I know
how to read/write isolated storage. " Did the code failed in the
particular thread nut work well out of it? Is the thread running with your
current log on user account?

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top