Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / March 2005

Tip: Looking for answers? Try searching our database.

Error message when attaching files programmatically

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tadhgc@yahoo.com - 03 Mar 2005 17:34 GMT
Hi

I get the following error message when I try to attach a file:
"'#PCDATA' is in nil content."

I am using the "ToBase64String" to convert the text file to a base64
string. I have verified that the conversion works correctly.
Then (and this may be what I am doing wrong) I am assigning the "text"
property of my IXMLDOMNode to this base64 string.

So my code is something like:

IXMLDOMNode oLogFileAttachment =
thisXDocument.DOM.selectSingleNode("//my:StdBVTLog");
..
//do file conversion to Base64
// return Base64 string
oLogFileAttachment.text = Base64Str;

>From having a quick search for this error message on the internet, I've
seen that this error is generated due to the "xsi:nil="true""
attribute.
To quote: "When this attribute is set to true, any text value of the
XML node produces XML that is not valid. Therefore, Microsoft Office
InfoPath does not accept the value, and you receive the error message."

Since I believe this attribute is ONLY saved to the XML when a file is
not attached then it would imply that the code I've used to attach the
file has failed.

Can anyone help with this?

thanks
Tadhg
G. Tarazi - 06 Mar 2005 12:47 GMT
The files are not just base 64, there is a file header that InfoPath adds at
the beginning of the file, you must add it programmatically.

We had this problem last year, and I've searched the blogs on the internet,
fond the structure on one of the blogs, and then wrote an encoder/decoder.

It is simple; the header includes a version number of InfoPath as I remember
the file size, and the name, + the file, I guess you may find more searching
the blogs, I don't have the code in front of me right now, sorry

> Hi
>
[quoted text clipped - 30 lines]
> thanks
> Tadhg
tadhgc@yahoo.com - 08 Mar 2005 10:57 GMT
Hi

Yes I found it and it worked.

Only I now have security issues with the Trusted form setup.

Basically I have given my code group and my local form full trust
permissions and published it to my sharepoint site. So when I open a
form from the sharepoint site it correctly attaches the file.
But since I can't sign the form within the Vstudio Infopath project,
everytime I try to debug the project it recompiles and changes the form
back to level 2 and then I get a security error.

any ideas?
thanks
Tadhg
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.