Hello I am currently creating a standalone C# application that is using the COM API to create an object in M-Files and I would like to be able to set the modified date and modified by but I have tried every method I can think of and it still does not set the property. I am able to set all properties successfully except the modified by and last modified. I was wondering if this is even possible and if so what method should I be using. Here are the different options that I tried
1.) Creating the propertyValue and adding it to the propertyValues object and passing it in with all the other properties during object creation.
PropertyValue modByProp= new PropertyValue() modByProp.PropertyDef = 23 modByProp.TypedValue.SetValue(MFDataType.MFDatatypeLookup, propertyInfo.itemID); propvals.Add(-1, modByProp); vault.ObjectOperations.CreateNewObjectEx(objectTypeID, propvals, sourceFiles, isSingle, true, null);
2.) Creating the object and updating it using SetLastModificationInfoAdmin
ObjectVersionAndProperties ovp = vault.ObjectOperations.CreateNewObjectEx(objectTypeID, propertyValues, sourceFiles, isSingle, false, null); vault.ObjectPropertyOperations.SetLastModificationInfoAdmin(ovp.VersionData.ObjVer, UpdateLastModifiedBy: true, modByPropval.Value, UpdateLastModified: true, modifiedPropval.Value); vault.ObjectOperations.CheckIn(ovp.ObjVer);
3.) using the setProperty finction instead of SetLastModificationInfoAdmin
ObjectVersionAndProperties ovp = vault.ObjectOperations.CreateNewObjectEx(objectTypeID, propertyValues, sourceFiles, isSingle, false, null); vault.ObjectPropertyOperations.SetProperty(ovp.VersionData.ObjVer, modByPropval); vault.ObjectOperations.CheckIn(ovp.ObjVer);
Any Help would be very much appreciated.