Hi all,
I am struggling to get a document URL with the API....
Let me try and explain what i am doing, see if it makes sense.
I have created a new document type - called Case Study.
This doc type has similar fields to the built in News type.
Using this new doc type i have created some documents in the site - all working.
I am creating a new web part which ultimately creates a list for use in a jQuery carousel. A single list item contains the CaseStudyTitle and also a thumbnail image CaseStudyThumbnail
This data is obtained using the CustomTableItemProvider class, and GetItems where my class of custom.CaseStudy is being used.
So far so good.
Now the problem i am having is getting the live URL to the CaseStudy document.
In the DataSet table i can only see columns for my custom table.
My question, is how can i use the data in the dataset to get a live URL for the document created using my CaseStudy doc type?
If this is not possible, what other way should i be creating my list?
I hope this make sense.......
To make things a little easier, here is the code so far:
CMS.TreeEngine.TreeProvider provider = new CMS.TreeEngine.TreeProvider();
CMS.SiteProvider.CustomTableItemProvider tp = new CMS.SiteProvider.CustomTableItemProvider(CMS.CMSHelper.CMSContext.CurrentUser);
DataSet ds = tp.GetItems("custom.CaseStudy", "", "");
string culture = CMS.CMSHelper.CMSContext.PreferredCultureCode;
string siteName = CMS.CMSHelper.CMSContext.CurrentSite.SiteName;
foreach (DataRow dr in ds.Tables[0].Rows){
// display title
string title = dr["CaseStudyTitle"].ToString();
// get Thumb image url
System.Guid thumbGUID = new Guid(dr["CaseStudyThumbnail"].ToString());
CMS.TreeEngine.TreeNode thumbNode = provider.SelectSingleNode(thumbGUID, culture, siteName);
string imageUrl = thumbNode.NodeAliasPath + ".aspx";
// get document url
//*********** THIS IS WHERE I AM STUCK AND NEED *************//
string docUrl = "#";
string link = "<a href='" + docUrl + "'><img src='" + imageUrl + "' /><br />" + title + "</a>";
// Output li element
HtmlGenericControl li = new HtmlGenericControl("li");
li.InnerHtml =link;
itemList.Controls.Add(li);
}
please help :-)