BSTR that exceeds string buffer length

wheresjustinwheresjustin Member Posts: 26
Hi all,

I am trying to get some data from the type 'Microsoft XML, v4.0'. IXMLDOMNode by calling the propery 'text' that returns a BSTR.

eg.

ThisNode.text;

However, there are times when this BSTR will be longer than the 1024 character limit of a Text variable, and I get the following error:

"the length of the text string exceeds the size of the string buffer"


I have been trying to trim the BSTR down to 1024 to stop this error message. I have tried several ways to do this including using the BSTRConnector:

Navision Attain Hash 1.0'.BSTRConverter

CREATE(bcon);
bcon.AppendNextStringPortion(ThisNode.text);
bcon.GetNextStringPortion(OutText, 1024);
CLEAR(bcon);

OutText is just a Text variable of length 1024.


The problem here is that the error still occurs at the line:
bcon.AppendNextStringPortion(ThisNode.text);

The AppendNextStringPortion parameter is a BSTR and ThisNode.text returns a BSTR. Is Navision trying to convert/cast ThisNode.text from the intrinsit BSTR to a Navision datatype (eg. Text), which is continuing to cause this error message?


Is there anyway to declare and Automation variable of type BSTR? I could not find the library it belongs to. Are there any BSTR operators to get a substring of a BSTR?

Comments

  • LoberLober Member Posts: 2
    Hi weresjustin

    try:
    CREATE(bcon); 
    i := 0;
    x := 1;
    bcon.BSTR(ThisNode.nodeTypedValue);
    WHILE i < bcon.GetBSTRLength DO BEGIN
      bcon.GetNextStringPortion(OutText[x],1024);
      i += 1024;
      x +=1;
    END;
    CLEAR(bcon); 
    
    


    The ThisNode.Nodevalue are collected in OutText-array
    :D
  • wheresjustinwheresjustin Member Posts: 26
    Thanks for that.

    Justin
  • Naidu.GNaidu.G Member Posts: 31
    Hi all,

    i am using 'Microsoft Outlook 12.0 Object Library'.MailItem to get CC in SentItems but some mails CC string exceeds the string size (>1024).

    i tried different ways to get the string size > 1024 but it show the same error(The length of the text string exceeds the size of the string buffer). Is there any solution to get the string size > 1024.




    Thanks & Regrads,
    naidu. ](*,)
Sign In or Register to comment.