3

I've been able to get my personal user information via C# -- WCF via https://docs.sdl.com/801922/351949/sdl-tridion-docs-13-sp2/using--svc-web-service-in-c--for-------------ishsts.

However, there is not much documentation on how to use other functions to retrieve data. I am trying to figure out how to access the data via this API and extract the GUID given a filename.

Are there any quick hints or sample code to help me out? Are there any good locations for WCF/C# sample code that uses provided library functions?

enter image description here

2
  • Welcome to Tridion StackExchange, please provide a bit more detail on what and where you are trying to get access to the GUID? you have mentioned GUID from files? what you mean here? Are you trying to get the published file info by post to publish plugin? please clarify a bit more detail?
    – Velmurugan
    Feb 22 at 9:23
  • Hi @Velmurugan, we have a hosted content manager system under SDL Tridion docs SP2, Within the repository there are folders and subfolders containing files. Each file (image, mp4, pdf, etc) has a unique GUID associated with it that is used within the database. You can directly go to the content manager and see the GUID by clicking "property" info button in the content manager. I want to extract these GUIDs and save them locally via WCF-API. Let me know if you need more detail.
    – abgup
    Feb 22 at 9:34
4

Let me clarify to help you with this.

SDL Tridion Docs comes in different WCF endpoints for different services.

Here is the list of WCF services available and Web Services classes and methods refer to the SDL documentation it provided web service each methods request and response XMLs detail, to start with you are already found the document for "using .SVC Web Service in C#", top of that you can add the additional services endpoints you need for your requirements. OOTB SDL Tridion Docs installation media only comes with 20130522.SdlTrisoft-WcfWebServices-JavaClient-Lab.zip and 20200501.InfoShare-14.0.4101.2.PluginSamples.zip not for the SVC C# web service sample, that's covered in the document.

enter image description here

For your requirement, I think you need to use Application.svc (authentication), Folder.svc (For getting the image folder items) and DocumentObj.svc (For accessing Illustrations image details)

Here are the high-level steps how you do to get that images to be download from that folder.

  1. Connect Application.svc service to authenticate
  2. Connect Folder.svc service Folder 2.5 GetContents API get the Illustration (media) object ishlngref (which is unique combination of version and language) Ids list.
  3. Use that step2 info to connect DocumentObj.svc service DocumentObj 2.5 GetMetaDataByIshLngRef (for getting the Illustration metadata properties) and GetDataObjectByIshLngRef APIs to download the Illustration object if required.

For your use case, you don't need a logical Id(I mean GUID), also to note GUID logical it's not unique by version and language. you have to use ishlngref value. some of the APIs you could use logical id(GUID) then you need to pass version and language info to get your object metadata values, if you really looking for GUID value then the response of the metadata object XML you can process to get the XPath value ishobjects/ishobject/@ishref

Updated: To find the FolderRef Id, go to the folder properties, and then in the popup URL, you can find the folderId in the query string parameter, in your case, you can configure this FolderId to pass to GetContents Folder API.

URL will look like something like:

https://locahost/ISHCM/FolderDlg.asp?Operation=Modify&FolderId=8159&Type=VDOCTYPEILLUSTRATION&UsrGrp=&Name=Images&MyFavorites=N&ParentId=3222 **

enter image description here

Example:

string xmlDocumentObjectList;
string lngRef = "8159"; #This is the value you need to get it from Folder GetContents API 
string documentTitle;
string documentStatus;
string documentLogicalId; //This is the GUID value you are looking for

string xmlRequestedMetadata = "<ishfields><ishfield name='FTITLE' level='logical'/><ishfield name='FSTATUS' level='lng'/></ishfields>";

//TODO to use your referened webservice proxy to initialize
xmlDocumentObjectList = documentObjProxy.GetMetaDataByIshLngRef(lngRef,xmlRequestedMetadata);


if (xmlDocumentObjectList != null)
{
    XDocument xObjectDoc = XDocument.Parse(xmlDocumentObjectList);

    if (xObjectDoc.XPathSelectElement("ishobjects/ishobject") != null &&
        xObjectDoc.XPathSelectElement(
            "ishobjects/ishobject/ishfields/ishfield[@name='FTITLE']") != null)
    {
        documentLogicalId =
            xObjectDoc.XPathSelectElement("ishobjects/ishobject")
                ?.Attribute("ishref") != null
                ? xObjectDoc.XPathSelectElement("ishobjects/ishobject")
                    ?.Attribute("ishref")?.Value
                : "";
        documentTitle = xObjectDoc
            .XPathSelectElement(
                "ishobjects/ishobject/ishfields/ishfield[@name='FTITLE']")?.Value;
        documentStatus = xObjectDoc
            .XPathSelectElement(
                "ishobjects/ishobject/ishfields/ishfield[@name='FSTATUS']")?.Value;
    }
}

I hope it helps.

3
  • Thanks Velmurugan! I have been able to add other endpoints to connect to more services. However, I didn't know which endpoints would be most useful so thank you. However, I don't know how to retrieve contents of the file even when using the GetContents API. // Create proxy instanceFolder25ServiceReference.FolderClient folderClient = new Folder25ServiceReference.FolderClient(); folderClient.GetContents();
    – abgup
    Feb 23 at 17:19
  • What should I pass into GetContents API? The documentation states identifier to the folder, but where should I be getting the identifier from? Additionally, I do want to retrieve GUID given metadata. Could you explain or link me to more detail to the "process to get XPath value ishobjects/ishobject/@ishref"
    – abgup
    Feb 23 at 17:33
  • 1
    Updated my answer
    – Velmurugan
    Feb 24 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.