|
Question : Accessing Notes Items in Domino with VB.NET
|
|
After the "doc = dbNotes.CreateDocument" line doc looks OK except items is Nothing. After the line "item = doc.GetFirstItem("Invoice_Number") " item is Nothing, which goes along with the previous. How do I associate the doc variable with the form "Document" which is in the dbNotes database? The form "Docuemnt" contains the fields/items that I am trying to populate.
I am using VS2005, VB.NET, and the Interop.Domino library, which doesn't seem to have a UIDocument. *********************************************************************************************** ' Setup Notes database access Dim NotesSession As New NotesSession Dim dbNotes As NotesDatabase Dim doc As NotesDocument Dim item As NotesItem Dim strArray As String() Dim I As Int32 Dim Field As String
frmMergeIC.sbMerge.Text = "Moving image to Notes"
' Add the image Try NotesSession.Initialize("") dbNotes = NotesSession.GetDatabase(NotesServer, NotesDatabase) doc = dbNotes.CreateDocument
' Update the Invoice Number item = doc.GetFirstItem("Invoice_Number") strArray = Split(invnum, "*") For I = 0 To UBound(strArray) Field = strArray(I) If Field <> "" Then Call item.AppendToTextList(Field) Next I
|
|
Answer : Accessing Notes Items in Domino with VB.NET
|
|
That is because a new document does not have any items. You need to create the item first using ReplaceItemValue.
instead of ...
item = doc.GetFirstItem("Invoice_Number")
... try using ...
item = doc.ReplaceItemValue("Invoice_Number", "")
|
|
|
|