Das Notes Forum

Domino 9 und frühere Versionen => ND6: Entwicklung => Thema gestartet von: Toma Bogdan am 11.06.04 - 15:13:36

Titel: error when I try to copy an intern field
Beitrag von: Toma Bogdan am 11.06.04 - 15:13:36
I receive the following error (attached file) when I try to copy an intern field

the code is:
Code
Set item_File = doc.GetFirstItem( "$File" )
If Not item_File  Is Nothing Then Call item_File.CopyItemToDocument( docnou, "$File" )
Titel: Re:error when I try to copy an intern field
Beitrag von: Glombi am 11.06.04 - 15:21:34
You have to copy the rich text field:

Example from Notes 5 Designer Help:

Dim docA As NotesDocument
Dim docB As NotesDocument
Dim rtitemA As Variant
Dim rtitemB As Variant
'...set values of docA and docB...
Set rtitemA = docA.GetFirstItem( "Body" )
Set rtitemB = docB.GetFirstItem( "Body" )
If ( rtitemA.Type = RICHTEXT And _
rtitemB.Type = RICHTEXT ) Then
  Call rtitemA.AppendRTItem( rtitemB )
  Call docB.Save( False, True )
End If

Andreas
Titel: Re:error when I try to copy an intern field
Beitrag von: Toma Bogdan am 11.06.04 - 15:29:02
You have to copy the rich text field:

Example from Notes 5 Designer Help:

Dim docA As NotesDocument
Dim docB As NotesDocument
Dim rtitemA As Variant
Dim rtitemB As Variant
'...set values of docA and docB...
Set rtitemA = docA.GetFirstItem( "Body" )
Set rtitemB = docB.GetFirstItem( "Body" )
If ( rtitemA.Type = RICHTEXT And _
rtitemB.Type = RICHTEXT ) Then
  Call rtitemA.AppendRTItem( rtitemB )
  Call docB.Save( False, True )
End If

Andreas
I receive the error Object variable not set at line rtitemB.Type = RICHTEXT ) Then !

PS. why my method works (in a similiar way with this method) for the Body field ?
Titel: Re:error when I try to copy an intern field
Beitrag von: TMC am 11.06.04 - 15:31:13
Toma,

There is no need to copy the $File - items. Just copy the Body-Richtext-Item via

Set itemMyBody = doc.GetFirstItem( "Body" )
If Not itemMyBody  Is Nothing Then Call itemBody.CopyItemToDocument( docnou, "BodyNew" )

The $File - items will be created automatically when you save the target document.
Titel: Re:error when I try to copy an intern field
Beitrag von: Toma Bogdan am 11.06.04 - 15:38:56
Toma,

There is no need to copy the $File - items. Just copy the Body-Richtext-Item via

Set itemMyBody = doc.GetFirstItem( "Body" )
If Not itemMyBody  Is Nothing Then Call itemBody.CopyItemToDocument( docnou, "BodyNew" )

The $File - items will be created automatically when you save the target document.
it doesn't works because I have an ~~tmpid.ide file (an ID file backup) in the $File field of the mail document so when I copy this doc I can't see anything in the destionation doc (the Body field doesn't exist in the source document)
Titel: Re:error when I try to copy an intern field
Beitrag von: TMC am 11.06.04 - 15:47:17
I don't know what you mean with "~~tmpid.ide file".
But it seems to me that you work with encrypted email - documents?

If so, have a look at the following code:
http://www.atnotes.de/index.php?board=5;action=display;threadid=15495

The script decryptes email-documents (incl. richt text items).