Fetch related property via c#

We want to search for a property that is related to another object via C#, to insert data into a table in the database of our sketch errors. Do you know how we could do this? Is there an example we can use? Here is our most recent code:

namespace teste4motivodrecusa
{
/// <summary>
/// The entry point for this Vault Application Framework application.
/// </summary>
/// <remarks>Examples and further information available on the developer portal: http://developer.m-files.com/. </remarks>
public class VaultApplication
: ConfigurableVaultApplicationBase<Configuration>
{
[EventHandler(MFEventHandlerType.MFEventHandlerBeforeCheckInChanges)]
public void TrocaMetadado (EventHandlerEnvironment env)
{

if (env.ObjVerEx.Class != 6 || env.ObjVerEx.State != 163) return;

ObjVerEx ob = env.ObjVerEx;
string teste = ob.GetPropertyText(1285) + ob.GetPropertyText(1060);
//string[] textoDividido = teste.Split(';');
//foreach (string s in textoDividido)
//{
// Console.WriteLine(s);
//}
var propMotivo = ob.GetProperty(1329);
propMotivo.Value.Value = teste;
ob.SaveProperty(propMotivo);

}
}
}
Parents Reply
  • So for this document you want to return 839?

    1. Load the object that property 1085 points to ("env.ObjVer.GetDirectReference(1085)").
    2. Load the text for property 1115.

    Something like:

    [EventHandler(MFEventHandlerType.MFEventHandlerBeforeCheckInChanges)]
    public void TrocaMetadado (EventHandlerEnvironment env)
    {
    
        if (env.ObjVerEx.Class != 6 || env.ObjVerEx.State != 163) return;
    
        ObjVerEx ob = env.ObjVerEx;
        var otherObject = ob.GetDirectReference(1085);
        var value = otherObject.GetPropertyText(1115);
        
        var propMotivo = ob.GetProperty(1329);
        propMotivo.Value.Value = value;
        ob.SaveProperty(propMotivo);
    
    }

Children