Ok... So now here's my code:
// create a TreeProvider instance
UserInfo ui = UserInfoProvider.GetUserInfo("administrator");
CMS.TreeEngine.TreeProvider tree = new CMS.TreeEngine.TreeProvider(ui);
HCC.Tag tag2 = (HCC.Tag)HCC.Tags.CurrentDocumentTags[0];
string where = "DocumentID IN ( SELECT DocumentID FROM CMS_DocumentTag WHERE TagID = " + tag2.ID + ")";
// get dataset of tree nodes specified by alias path and class names (separated by semicolon),
// the second parameter says whether to return default culture documents if the required
// document language version is not available
DataSet ds = tree.SelectNodes("Community Chapel", "/Crossroads/%", "en-us", true, "cms.menuitem;cms.products", where, "TagID ASC");
foreach (DataRow dr in ds.Tables[0].Rows)
{
Literal doc = new Literal();
doc.Text = "Doc: " + dr["DocumentID"].ToString();
plContentText.Controls.Add(doc);
}
And I get this error:
[DataConnection.ExecuteQuery]: Query: SELECT * FROM View_CONTENT_MenuItem_Joined WHERE (((((SiteName = N'Community Chapel') AND (Published = 1)) AND (DocumentCulture = N'en-us')) AND (NodeAliasPath LIKE N'/Crossroads/%')) AND (DocumentID IN ( SELECT DocumentID FROM CMS_DocumentTag WHERE TagID = 23))) ORDER BY TagID ASC : caused exception: Invalid column name 'TagID'.