Absent Member.
Absent Member.
466 views

Is this the correct way to dump all the files in Trim?

Could someone just review the code below to see if this is the correct way to dump to disk all the files in Trim?

 

 

using (Database db = new Database())
{
   db.WorkgroupServerName = "trimsrv";
   db.Connect();

   Directory.CreateDirectory(@"C:\temp\trimdump");

   TrimMainObjectSearch records = new TrimMainObjectSearch(db, BaseObjectTypes.Record);
   records.SelectAll();
   records.SetFilterString("type:document");
   foreach (Record resultRecord in records)
   {
      using (var d = resultRecord.GetExtractDocument())
       {
           if (d != null)
           {
               d.DoExtract(@"C:\temp\trimdump", true, false, "");
           }
       }
   }
}

 

 

Cheers

John

0 Likes
3 Replies
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Is this the correct way to dump all the files in Trim?

If you want to dump ALL files, you're missing revisions, renditions and quite a few others.

 

Other than that if you only want the latest revision of all records, you should be pretty close. You might want to filter take care for records with no documents (in your search filter) and possible filename collisions (and not just overwrite).


(Any opinions expressed in this forum are my own personal opinion and should not be construed as an official statement by DXC Technology.)

Analytics & Data Management
Application & Business Services
DXC Technology
0 Likes
Highlighted
Absent Member.
Absent Member.

Re: Is this the correct way to dump all the files in Trim?

Thanks a lot for the info.

Yes, we're just after the latest revisions of all records.

I can't figure out what is the filter I need to apply to only get records with documents?

 

Cheers

John

0 Likes
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: Is this the correct way to dump all the files in Trim?

You could have tried to figure it out using the TRIM search interface (and maybe you have by now).

It's just using the filter "extension:*". You don't even need to use the record type filter, as this criterium wil automatically filter those from the resultset.


(Any opinions expressed in this forum are my own personal opinion and should not be construed as an official statement by DXC Technology.)

Analytics & Data Management
Application & Business Services
DXC Technology
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.