The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RestAPI : Set the CreatedBy

Is there any equivalent of the SetCreationInfoAdmin method in the Rest API ?

M-Files API - SetCreationInfoAdmin Method (m-files.com)

I've tried setting the Property 25 but the value never changed.

We are planning to create document from an external application using a custom application user but need to associate the document to an actual M-Files user.

Parents
  • Hi Sebastien,

    Actually, if you set the "Created By" property to correct MFilesUserID, you should be able to set correctly "Created By" property. I have used it during some migration tasks where I needed to take over information who created a document. It is important that your logic maps external user to M-Files user ID (usually if you have object type Employee or similar you have behind reference to M-Files user). When you upload your document, you should provide "Created By" in the list of properties and it should do the job.

    What how ever not works always is setting up "Last Modifed By" property when you upload from external a document with properties. In that case that worker process/admin user is assigned, even though you set your specific user.

    Another problems are "Created" and "Last Modifed" timestamps which I am unfortunately not aware how to set.

    I am using M-Files REST Library (C#).

    Dejan

  • That's the first thing I've tried before posting in the forum.

    For me it doesn't work as I received an error 500 "Access denied. You do not have the access rights required by this operation." when setting property 25.

    I'm using Postman to build my scenario. I will take a look at the REST library.

  • What type of user are you making this request with? What rights do they have in the vault? 

  • Well, I use a normal user rights (aka nothing checked on the user). I thought I have test it with full control after that... must have made a mistake in my multi-server env because now it works.

    Do you know if there is a special permission I can set? I'd rather not give that user Fullcontrol on the vault.

  • Look like that's the only permission needed

  • So, in general this is what I would expect.  I wouldn't expect a standard user to be able to create objects and state that they were created by another user.

    I do have a deep-seated concern about creating objects that, according to the audit trail, were created by other users.  But maybe that's a topic for another time and place.

  • Good to know that only "Manage user accounts" is needed. As we do migration our user has a full control of vault. Definitely usual user would not have rights to set those technical metadata. 

    One thought: would it not be better to run your upload as a user using windows authentication? Would it not get updated automatically in that case based on windows authentication? You can make a single sign-on over REST API.

  • Yes this is our backup plan if we cannot setup the sso to work.

    Our apps already use AzureAD but our M-Files server is on premise AD.
    We still need to work on that part and see if sso is possible or not.

Reply Children
No Data