Obtaining Publishing Folder from Page

24 views
Skip to first unread message

suzan...@gmail.com

unread,
Jul 26, 2017, 1:36:01 PM7/26/17
to SmartAPI
Hello,

I am trying to obtain the publishing folder of a specific page (for example, Page1 should be published to root/subfolder1/subfolder2).

I am looking at some properties in Smart API and am trying to get it by using the following code:

Pages _pages = new Pages(selectedProject);

var languageVariant = selectedProject.LanguageVariants.Current;

var getPage = _pages.GetByGuid(pageGuid, languageVariant);


var mainLink = (ILinkElement)getPage.GetType().GetProperty("MainLinkNavigationElement").GetValue(getPage, null);


var getTempDirectory = (IApplicationServer)mainLink.GetType().GetProperty("Server").GetValue(mainLink, null);

However, I am getting an object reference error on the last line. I am unsure if this will even give me what I am trying to achieve. Any feedback would be much appreciated.

Thank you!

Suzanne

suzan...@gmail.com

unread,
Jul 31, 2017, 3:46:43 PM7/31/17
to SmartAPI
To clarify further.. I am trying to obtain the virtual name from the publication folder. I am able to get a list of the publication folders and their attributes for the entire project but I am wondering if there is a way to obtain it from a page level (e.g. passing in a page guid and somehow finding its publication folder)

This is the code I am using to obtain a list of all publication folders for the project:

 private List<XmlElement> GetPublicationFolder()
    {
        //Get the selected project
        var session = ServerConnection();
        var serverManager = session.ServerManager;
        IProject selectedProject = serverManager.Projects.ForCurrentUser.GetByGuid(projectGuid);
        List<XmlElement> urlList = new List<XmlElement>();
        //loop through all the publicationtargets and get the elements of each 
        foreach (project.Publication.IPublicationFolder t in selectedProject.PublicationFolders.ToList())
        {
            var element = (XmlElement)t.GetType().GetProperty("XmlElement").GetValue(t, null);
            //add each element into a list
            urlList.Add(element);
        }

        return urlList;

    }

Thank you,

Suzanne Ly

Jonas Jacobi

unread,
Aug 1, 2017, 8:10:26 AM8/1/17
to smar...@googlegroups.com

I don’t think there is a build in way to do what you want in the current SmartAPI, sorry.

I’ll have to check the RQL statements, if it would be possible to get that info. Not sure when I’ll find the time to do that atm though :/.

--
More information about SmartAPI: http://www.smartapi.de
---
Sie erhalten diese Nachricht, weil Sie in Google Groups E-Mails von der Gruppe "SmartAPI" abonniert haben.
Wenn Sie sich von dieser Gruppe abmelden und keine E-Mails mehr von dieser Gruppe erhalten möchten, senden Sie eine E-Mail an smartapi+u...@googlegroups.com.
Wenn Sie in dieser Gruppe einen Beitrag posten möchten, senden Sie eine E-Mail an smar...@googlegroups.com.
Weitere Optionen finden Sie unter https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages