Showing results for 
Search instead for 
Did you mean: 

Using SOA, how do we get file size of the UGMASTER under an Item Revision?



I just thought of using this forum to get some help related to extracting file size of a UGMASTER under an Item revision.

Infact i raised a ticket in GTAC, India. Not much help i received from GTAC.


Let me explain my use case:

I have an item revision which has a UGMASTER, UGPART, files underneath it. Now, using the below code i was able to get model Object of each type above and then trying to check the file size of the UGMaster uploaded under the item revision. 

Teamcenter.Services.Strong.Core._2006_03.FileManagement.FileTicketsResponse getFileResp = fms.GetFileReadTickets(aIMANFiles); This line returns NULL


DataManagementService dmService = DataManagementService.getService(Session.getConnection());

for (int i = 0; i < objects.Length; i++)

  if(!(objects[i] is WorkspaceObject ))

 bool bIsItemRevCode1 = false;
ExpandGRMRelationsPref2 relationPref = new ExpandGRMRelationsPref2();
RelationAndTypesFilter typeFilter1 = new RelationAndTypesFilter();
relationPref.ExpItemRev = false;
typeFilter1.OtherSideObjectTypes = new String[] { "UGMASTER", "UGPART"};
relationPref.Info = new RelationAndTypesFilter[] { typeFilter1 };
ExpandGRMRelationsResponse2 response2 = dmService.ExpandGRMRelationsForPrimary(new ModelObject[] { curmodlobj }, relationPref);
int subojs_size2 = response2.ServiceData.sizeOfPlainObjects();
String filesize;

for (int kk = 0; kk < subojs_size2; kk++)
  ModelObject sub_child = response2.ServiceData.GetPlainObject(kk);
  String strobjecttype = sub_child.GetPropertyDisplayableValue("object_type");

  if (strobjecttype == "UGMASTER")
    FileManagementService fms = FileManagementService.getService(Session.getConnection());
    Teamcenter.Soa.Client.Model.Strong.ImanFile[] aIMANFiles = new Teamcenter.Soa.Client.Model.Strong.ImanFile[1];
    aIMANFiles[0] = new Teamcenter.Soa.Client.Model.Strong.ImanFile(curmodlobj.SoaType, curmodlobj.Uid);

    Teamcenter.Services.Strong.Core._2006_03.FileManagement.FileTicketsResponse getFileResp = fms.GetFileReadTickets(aIMANFiles);  // This returns NULL
    string[] tickets = new string[getFileResp.Tickets.Count];
    string[] paths = new string[getFileResp.Tickets.Count];
    int a = 0;
    foreach (System.Collections.DictionaryEntry pair in getFileResp.Tickets)
     tickets[a] = (String)pair.Value;

     paths[a] = ((Teamcenter.Soa.Client.Model.Strong.ImanFile)pair.Key).Original_file_name;
     //expandGRMRelationsForPrimary(dmService, subChildren, "ImanFile");
     filesize = sub_child.GetProperty("file_size").DisplayableValue;