Skip to Content
author's profile photo
Former Member

Attachment object AbsoluteEntry not valued after add

Hello,

I'm trying to attach files with the Attachments2 object in SBO 2005 and i need to get the autogenerate key (AbsoluteEntry) after adding an attachment.

SBO help says:

AbsoluteEntry Returns the identification key of the attachment file as assigned by SAP Business One when adding an attachment file.

But after calling the add method the property is always set to 0 even if the AbsEntry field in the record created in ATC1 is correctly valued.

Here is my code:

dsa_Attach.Lines.Add()

dsa_Attach.Lines.FileName = "test"

dsa_Attach.Lines.FileExtension = "txt" dsa_Attach.Lines.SourcePath = "c:\"

dsa_Attach.Lines.Override = SAPbobsCOM.BoYesNoEnum.tYES

ReturnCode = dsa_Attach.Add()

debug.writeline(dsa_Attach.AbsoluteEntry) 'always 0 (ReturnCode = 0)

If anyone has some hints .....

Thanks

Fabrice.

PS: i also wonder why there is no "remove" method in this object (?)

Message was edited by: Fabrice NANNI

Message was edited by: Fabrice NANNI

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    author's profile photo
    Former Member
    Oct 07, 2005 at 01:04 PM

    Hi Fabrice,

    I am not using SBO 2005, but know that in 2004 SDK you get the last generated number with

    oCompany.GetNewObjectCode

    I know this works for invoices, business partners, items etc. Don't know if it's going to work for you, but it's worth a try.

    Let me know if it helps,

    Adele

    Add comment
    10|10000 characters needed characters exceeded