cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrive document description?

0 Kudos

Hello,

I am currently working on program which search and open document from ECTR based on document number. How can I also retrieve document description in this code?

//Code
DocSearch docSearch = new DocSearch();  
docSearch.DocNumber = "40000169574";

IPlmConnector connector = PlmConnectorFactory.GetPlmConnector(config);
IPlmResponse plmResponse =connector.SearchDocument(ListParts, docSearch, Com.Dscsag.Plm.Comm.SelectionMode.DEFAULT);            
string strFileName = plmResponse.Parts[0].Filename;
string strDocumentDescription= ???

acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.Open(strFileName, false);
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument = acDoc;

Thank you for your time.

MD

Accepted Solutions (1)

Accepted Solutions (1)

GerhardHimmelsb
Advisor
Advisor
0 Kudos

Hello Mangesh,

The connector function "SearchDocument" does not retrieve any metadata about a document. The metadata can be read with the function "ProvideInfo".

Here is a small code example:

string partFileName = ....
IPlmRequestPart part = new
PlmRequestPartImpl(partFileName);
// read meta data from SAP to get description
PlmRequestPartList parts = new PlmRequestPartList();
parts.Add(part);
IPlmResponse response = connector.ProvideInfo(parts, true);
PlmResponsePartList provideInfoParts = response.Parts;

foreach (IPlmResponsePart responsePart in provideInfoParts)
{
    PartInfo info = responsePart.PartInfo;
    if (responsePart.Action == PartAction.DO_NOTHING && info != null)
    {
        logger.Trace("Results of Provide Info Process for: " + responsePart.Filename);
        logger.Trace("Param: IS_OK: " + info.Ok);
        if (info.Ok)
        {
            // trace description
            string partDescription;
            
info.Metadata.TryGetValue("DESCRIPTION", out partDescription);
            logger.Trace("Descripton: " + partDescription);
            // trace all meta data
            logger.Trace("MetaData...");
            foreach (var entry in info.Metadata)
                logger.Trace(" NAME: " + entry.Key + " VALUE:" + entry.Value);
        }
    }
}

Regards,

Gerhard

0 Kudos

a quick follow up question on this. This retrieves the description as per my needs but I also noticed that some of the imported documents gets their description cut short like there is limitation on length. Please refer to the attached screenshot in which the document description is "This file is temporary test bed to verif" which is retrieved by using the code above. However, the original description is "This file is temporary test bed to verify working of PLM connector". Is there anyway to retrieve this description?

Answers (2)

Answers (2)

GerhardHimmelsb
Advisor
Advisor
0 Kudos

Hi MD,

description is only 40 characters long. The rest is stored in long text.

That's why you see only the first 40 characters and the rest is show in full length below in you screenshot.

Regards,

Gerhard

0 Kudos

I was looking for ways to retrieve the long text. Some documentation suggested it can be used using "LONG_TEXT" in java but I couldn't find similar way or information during debug. It was not part of metadata, responsepart or partinfo. Is it possible to retrieve "LONG TEXT"?

0 Kudos

Thank you for the answer. I will try it out soon.