Convert XDocument to string

E

Eigh

Hi.

I have an infopath form that a previous developer wrote that saves an
XDocument object using XDocument.SaveAs(...)

I want to write the XDocument to a file and then upload it to MSCRM as an
attachment. When I run XDocument.SaveAs(filename) it saves it just fine,
but then when I try to upload it to MSCRM, it thinks that the file is locked
from the previous statement.

Is there any way to programmatically "unlock" the file? Or perhaps pause
until the file is unlocked so that the two file operations don't overlap?

As an alternate route, If I could serialize the XDocument file to a String
object instead of as a file, I could use that string to upload it to CRM.
The function that I wrote converts it over to a string anyway, so this is
probably the better of the two solutions.

Can anyone give me a suggestion on how to reach either of these two solutions?

THanks,

Eigh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top