This is actually one big blur of questions which came to mind on a certain issue.What I'm actually trying to do is to add entries to our sharepoint server through outlook. The issue that I'm stuck on is the description to send. I have a form with amongst others a \[code\]RichTextBox\[/code\] which is used for the description. I need to add my mail body to this \[code\]RichTextBox\[/code\] and this is where the problems arise. Here are my main questions:
- What does the RTF body do? I can get the RTF body from the mail as a byte[] and then use the following code to convert it to my \[code\]RichTextBox\[/code\] RTF property:\[code\]System.Text.Encoding encoding = new System.Text.ASCIIEncoding();RTF = encoding.GetString(mailItem.RTFBody);richTextBoxDescription.Rtf = RTF;\[/code\]The problem is in this case that I have double line breaks after putting the rtf in my \[code\]RichTextBox\[/code\] and have no idea how to get rid of them since the RTF looks something like this because of the HTML format body: \[code\]}\htmlrtf {\htmlrtf0 Text here..., {\*\htmltag244 } {\*\htmltag252 }\htmlrtf\par}\htmlrtf0 \htmlrtf \par \htmlrtf0 {\*\htmltag72 \[/code\]Also in this case the possible images in my body show as \[code\]cidImagename.etc...\[/code\]
- How can I perfectly convert HTML to RTF? The thing I now use most to fill my \[code\]RichTextBox\[/code\] is the same I use to convert my RTF to html when I write it to the SharePoint server: http://code.msdn.microsoft.com/windowsdesktop/Converting-between-RTF-and-aaa02a6e .This works perfectly fine in the RTF to html case but for converting my \[code\]olMailItem.HTMLBody\[/code\] string to RTF it doesn't work very well. Whenever there is a table in my htmlbody the XAML (the library uses rtf to xaml and xaml to html to convert) throws an error on it and I can't convert my string. Also, in this case the possible images in my body are not shown at all.
- How does the clipboard succeed in perfectly copying my mailItem body to the \[code\]RichTextBox\[/code\]? I've tried selecting and copy pasting the mailItem body into the \[code\]RichTextBox\[/code\] and this works perfectly. All the markup is kept the same and the images are shown too. Side question on this: Would I be able to write this to my SharePoint server? If so, do I still need to use the RTF to HTML converter or can I encapsulate it in another way so that it looks the same in the browser?