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

Question

Question

Unable to save Data/Blob type field

SDK
asked on July 7, 2016

I am trying to use the following code to assign a value to a Data/Blob type field with RepositoryAccess 10.0, but the field is not assigned and no error is thrown. I can use the same logic to assign String, Date, Numeric, etc. type fields, but cannot get it to work with Data-type fields. In the code below, the Data-type field does not get assigned but the String-type field does get assigned. I have tried assigning a string value and a byte array value, separately, without success. Should a different type of object be used or am I missing another detail?

        Server serv = new Server("my serv");
        RepositoryRegistration rep = new RepositoryRegistration(serv, "my rep");
        Session session = new Session();

        session.CanShareLicense = true;
        session.LogIn(rep);

        int docId = Document.Create("my doc", "DEFAULT", EntryNameOption.AutoRename, session); 
        DocumentInfo lfEntry = Document.GetDocumentInfo(docId, session);
        FieldValueCollection lfFData = lfEntry.GetFieldValues();

        lfFData["Data Field Name"] = System.Text.Encoding.Unicode.GetBytes("test value");
        lfFData["String Field Name"] = "1234";
        lfEntry.SetFieldValues(lfFData);
        lfEntry.Save();

        session.Close();

 

0 0

Answer

SELECTED ANSWER
replied on July 7, 2016

This is a bug in Repository Access, it has been fixed in RepositoryAccess 10.1 (bug reference#141081)

0 0

Replies

replied on July 7, 2016 Show version history

The code works for me, here is what I see on my document after running it:

Edit: I found that this has been fixed in RepositoryAccess 10.1 (reference#141081)

0 0
replied on July 7, 2016 Show version history

I'm running Laserfiche Server 9.2.1. This is what I'm seeing in my document after the code runs:

 

If I run similar code using LFSO83, I successfully get the data entered:

      LFApplication app = new LFApplication();
      LFServer serv = (LFServer)app.GetServerByName("my serv");
      LFDatabase db = (LFDatabase)serv.GetDatabaseByName("my rep");
      LFConnection conn = new LFConnection();

      conn.Shared = true;
      conn.UserName = "";
      conn.Password = "";
      conn.Create(db);
      
      LFDocument lfEntry = new LFDocument();
      lfEntry.Create("my doc", db.GetEntryByPath("\\"), db.GetVolumeByName("DEFAULT"), true);
      LFFieldData lfFData = (LFFieldData)((LFDocument)lfEntry).FieldData;
      lfFData.LockObject(Lock_Type.LOCK_TYPE_WRITE);

      lfFData.set_Field("Data Field Name", System.Text.Encoding.Unicode.GetBytes("test value"));
      lfFData.set_Field("String Field Name", "1234");

      lfFData.Update();
      lfFData.UnlockObject();
      lfEntry.Update(); 
      lfEntry.UnlockObject();

      conn.Terminate();

0 0
SELECTED ANSWER
replied on July 7, 2016

This is a bug in Repository Access, it has been fixed in RepositoryAccess 10.1 (bug reference#141081)

0 0
replied on July 7, 2016 Show version history

Thank you! Is the 10.1 SDK released?

0 0
replied on July 7, 2016

No, your best bet at the moment is to either use LFSO to set the data fields, or install one of the 10.1 LF components that would get you a newer build of Laserfiche.RepositoryAccess.dll.

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

Sign in to reply to this post.