You are viewing limited content. For full access, please sign in.

Question

Question

Using EntryInfo

SDK
asked on March 31, 2014

 Greetings,

I need some assistance adding fields to an existing document without a template.  I am trying to use the entryinfo method however is am getting an error.  here is the code.

 

 Public Function AssignTemplate(ByVal EntryID As String) As Boolean
        EI = Entry.GetEntryInfo(EntryID, mySess)
        EI.Lock(LockType.Exclusive)
        Dim FVC As New FieldValueCollection(EI.GetFieldValues)
        For z As Integer = 0 To FIELDCOUNT
            FVC(mArray(z, 0).ToString) = IndexArray(z + 1)
            EI.SetFieldValues(FVC)
        Next
        EI.Save()
        EI.Unlock()
        EI.Dispose()
        EI = Nothing

the error I am getting is

"The object is not identified, and cannot be locked or read from.
Parameter name: path" The error indicate the path cannot be found however I am using the enty ID.  the Entry.id is valid, and the Session is connected.

 

version of the SDK is 8.3

 

Please let me know what I am missing.

 

Phil Joyce

One Source.

 

0 0

Answers

APPROVED ANSWER
replied on March 31, 2014

You are passing in your EntryID as a string, which is causing your call to GetEntryInfo to use the overload which expects a string path. Instead, pass the EntryID As Integer, which will cause the appropriate version of GetEntryInfo to be called.

1 1
SELECTED ANSWER
replied on March 31, 2014 • Show version history

Phil,

 

In addition you only need to call the SetFieldValues() method once to set all of the field values for the document.  Here is a code snippet;

   Public Function AssignTemplate(ByVal EntryID As Integer) As Boolean
        Dim returnValue As Boolean = True

        Try
            Dim EI As EntryInfo = Entry.GetEntryInfo(EntryID, mySess)
            Dim FVC As FieldValueCollection = EI.GetFieldValues

            EI.Lock(LockType.Exclusive)

            'FieldValueCollection is a 0 based collection...
            For z = 0 To FVC.Count - 1
                'Update the FieldValueCollection here...
            Next

            'Set the document field values to the new values...
            EI.SetFieldValues(FVC)
            'Persist the changes...
            EI.Save()

            EI.Unlock()
            EI.Dispose()

        Catch ex As Exception

            returnValue = False

        End Try

        Return returnValue

    End Function

 

0 0

Replies

replied on April 2, 2014

Thanks for your help Guys!!!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.