DotNet MemoryStream

mikmik Member Posts: 79
edited 2015-08-04 in NAV Three Tier
Hi,

I am just working on an external component and need to pass MemoryStreams to this .dll.

I found the following information for this topic.

http://kauffmann.nl/index.php/2012/04/04/binary-data-with-nav-web-service/

In this example you can see that he is using the command
COPYSTREAM(MemoryStream,InStream);

I have atm the problem, that I can use this because of following error.

](*,)
Unable to convert from Microsoft.Dynamics.Nav.Runtime.NavDotNet to Microsoft.Dynamics.Nav.Runtime.NavOutStream.

Every DotNet Global is running on Client ("yes")

I'm using a Three-Tier Environment. Version: 7.10.36.366

greetings mik

With kind regards
mik

Answers

  • mikmik Member Posts: 79
    Hi,
    I think I just found the solution after the longest 4 hours of my life. \:D/

    I did the following....
    Name		        DataType	        Subtype	Length
    AdvancedPDF	DotNet		mpAdvancedPDF.AdvPDF.'mpAdvancedPDF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e520dfe28c1ca5b5'	
    MemoryStream	DotNet		System.IO.MemoryStream.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'	
    Stream		DotNet		System.IO.Stream.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'	
    InStr		        InStream	
    
    
    MemoryStream := MemoryStream.MemoryStream;
    Document.CALCFIELDS(BlobField);
    IF Document.BlobField.HASVALUE THEN BEGIN
      Document.BlobField.CREATEINSTREAM(InStr);
      Stream := InStr;
      Stream.CopyTo(MemoryStream);
      Message(Format(MemoryStream.Length()));
    END;
    
    


    greetings mik

    With kind regards
    mik
  • Benno67Benno67 Member Posts: 39
    Was trying also, but method CopyTo does not exist on a system.io.stream???

    How did you managed compiling that code?
  • Van_ScimanydVan_Scimanyd Member Posts: 8
    edited 2015-12-29
    In this stackoverflow post it is said that the CopyTo() method has been implemented since .NET 4 but Mik gives a list of .net vars using version 2, maybe his code uses version 4 and he wrote version 2 on mibuso ?
Sign In or Register to comment.