cancel
Showing results for 
Search instead for 
Did you mean: 

Export file stored in Teamcenter by using SOA library in C++

Experimenter
Experimenter

Hi,

 

I am developing a software system in C++ which has to connect to Teamcenter and download a selected Dataset.

 

The system is able to load all data of the selected Dataset but it is not able to download the file and get its loacal path.

 

Could you, please, help me to find a solution to export a file from Teamcenter and get its local path?

 

Thank you in advance for help.

4 REPLIES

Re: Export file stored in Teamcenter by using SOA library in C++

Phenom
Phenom

I have done this, but with differences that I used C# and I specified location/path where the files should be downloaded.

 

1. Get ImanFile objects from Dataset

2. Get file read tickets, here you get also the 'original_file_name' of ImanFile

3. Register file tickets to FCC

4. Download files to location i.e. "checkoutFolder" in my case

 

This code should help:

 

FileManagementService fms = FileManagementService.getService(Session.getConnection());
DataManagementService dms = DataManagementService.getService(Session.getConnection());

Teamcenter.Services.Strong.Core._2006_03.FileManagement.FileTicketsResponse getFileResp = fms.GetFileReadTickets(aIMANFiles.ToArray<ImanFile>());

tickets = new string[getFileResp.Tickets.Count];
paths = new string[getFileResp.Tickets.Count];
int a = 0;

foreach (System.Collections.DictionaryEntry pair in getFileResp.Tickets)
{
tickets[a] = (String)pair.Value;

paths[a] = ((ImanFile)pair.Key).Original_file_name;
a++;
}

 

if (aPrgDialog.isRunning() == true)
{
aPrgDialog.addPos();
aPrgDialog.setText(String.Format(m_pUtilities.GetMessage("R277"), Convert.ToString(paths.Length)));
aPrgDialog.pumpMessage();

string[] uids;
int[] ifails;

Teamcenter.FMS.FCCProxy.ClientCache.NetFileCacheProxy fmsfileCacheProxy = new Teamcenter.FMS.FCCProxy.ClientCache.NetFileCacheProxy();
fmsfileCacheProxy.RegisterTickets(tickets, out uids, out ifails);

 

if ( ifails.Length > 0) { throw new Exception("Errors Registering file tickets"); }

fmsfileCacheProxy.DownloadFilesToLocation("Default", uids, null, paths, checkoutFolder, paths, out ifails);

Re: Export file stored in Teamcenter by using SOA library in C++

Experimenter
Experimenter

Thanks for the reply.

 

I have tried to do in the same way but the variable ticket is always empty.

 

 

1. I try to use the  Teamcenter:Smiley Frustratedoa::Client::ModelObjectTypeFactory to create a ImanFile Object with the ID and Type.

2. I use the FilemanagementService :: getFileReadTickets

 

the Filemanagement::FileTicketsResponse contains an empty TicketMap but also no ErrorStack etc.

 

do you have any hint what I could do wrong?

best regards

 

Maria

 

Re: Export file stored in Teamcenter by using SOA library in C++

Phenom
Phenom

If you are getting the correct ImanFile objects, but you are still unable to get File-tickets; make sure following:

 

1. 4-tier RAC is installed (on PC where the code is being executed) with env variable FMS_HOME set correctly

2. Environment variable PATH contains %FMS_HOME%\lib  (best to have this at the start in PATH, so that it is not truncated if value of PATH is too long)

Re: Export file stored in Teamcenter by using SOA library in C++

Pioneer
Pioneer
I have FMS_HOME and FMS_HOME\lib set correctly, getFileResp.Tickets.Count still equals 0. Of note, IManFile does not have an ToArray function. aPrgDialog is never instantiated, one can safely assume it is short for aProgramDialog, but I had to comment out the if() structure it was contained in, as well as all statements utilizing it. I can't seem to get a response from anyone, as of yet, pertaining to how to create and FMS ticket. Please advise