I'm using Ektron CMS version 8.5 SP2.
I have some items in a taxonomy. Some are actual pages, some are library items (documents like Word files and PDFs).
Let's say there are 3 pages and 2 library items for a total of 5 items in my taxonomy.
I use the following code...
ContentManager cManager = new Ektron.Cms.Framework.Content.ContentManager();
Ektron.Cms.Content.ContentTaxonomyCriteria ctCriteria = new Ektron.Cms.Content.ContentTaxonomyCriteria();
ctCriteria.AddFilter(1707, true); // hard coded taxonomy ID
List<ContentData> list = cManager.GetList(ctCriteria);
Label1.Text = list.Count.ToString();
When this code runs, the count of items in the list is 3. If I output the actual list, I can see it's only the pages in the taxonomy, not the 2 library items.
It seems that the ContentManager.getList() function does not get library items, even when those items have been added to the taxonomy. I can confirm that in the admin workarea, the library items are visible in the taxonomy.
For clarification, this is a problem with retrieving items that have already been added to the taxonomy.
Does anyone know how I can retirieve a list of all items in a taxonomy, including any library items in there.
Note: If I add the files to the Document Managment System instead of the library, it works perfectly. But in the live system, I have hundreds of items in the library and I'm hoping theres' a way to view them via a taxonomy without having to move them all into the DMS.
I have posted this question on the Ektron developers forum as well, but I've had no reply. I'm hoping somebody here can help.
Cheers.
A follow up to my comment from the other day on #nedlud's answer, I felt like this deserved its own answer though.
According to the Framework API docs:
If intent is to retrieve CMS items that have been categorized in Taxonomies, use TaxonomyItemManager.
But as already noted in the comments, the TaxonomyItemData objects returned by this API have a number of empty properties such as QuickLink and Html. I've found that using the TaxonomyManager, one can successfully query for items assigned to particular taxonomy categories.
Here's a brief snippet using the Framework API (version >= 8.5); this feels reminiscent of working with the older (version <= 8.0) taxonomy API wherein one would create a TaxonomyRequest and get an object structure back that encapsulated not only the taxonomy iteself, but the items categorized into that taxonomy:
//e.g. for a single-level taxonomy
long taxRoot = 1707; //from OP's question
TaxonomyManager taxManager = new TaxonomyManager();
//GetTree overload supplying includeItems parameter
TaxonomyData taxTree = taxManager.GetTree(taxRoot, includeItems: true);
foreach(TaxonomyItemData taxItem in taxTree.TaxonomyItems)
{
//these should print true
Response.Write(!String.IsNullOrEmpty(taxItem.QuickLink));
Response.Write(!String.IsNullOrEmpty(taxItem.Html));
}
I'm currently refactoring some version 8.0 code into version 8.6 and converting to the Framework API. Until Ektron fixes the (bug?) of TaxonomyItemManager returning TaxonomyItemData with null properties, I'll be using the above method + LINQ for the sorting/filtering/etc.
I would look at the TaxonomyItemManager rather than the ContentManager.
Thanks to #maddoxej suggestion of using the TaxonomyItemManager, I have working solution code...
TaxonomyItemCriteria criteria = new TaxonomyItemCriteria();
criteria.AddFilter(TaxonomyItemProperty.TaxonomyId, CriteriaFilterOperator.EqualTo, 1707);
TaxonomyItemManager taxonomyItemManager = new TaxonomyItemManager();
List<TaxonomyItemData> taxonomyItemList = taxonomyItemManager.GetList(criteria);
Label1.Text = taxonomyItemList.Count.ToString();
This code now shows the expected count of "5", and I can display all the itmes :)
So many "manager" classes in Ektron.
Related
I am using the eBay Trading API with C# .NET SDK
I created a ReturnPolicyType
ReturnPolicyType policy=new ReturnPolicyType();
I set the policy properties and everything seems to work except the restocking fee
policy.RestockingFeeValue = "Percent_15";
And:
policy.RestockingFeeValueOption = "Percent_15";
I've also tried "15%" instead of "Percent_15"
but neither of them show the restocking fee on the listing
I've also asked the question on eBay's developer forums but they are pretty vacant of activity.
My full return policy code is below
ReturnPolicyType policy=new ReturnPolicyType();
policy.Refund="MoneyBack";
policy.ReturnsWithinOption="Days_30";
policy.ShippingCostPaidBy = "Buyer";
policy.RestockingFeeValue = "15%";
policy.RestockingFeeValueOption = "Percent_15";
policy.Description = "Returns are welcome on all items other than those sold on an 'AS - IS' basis. Buyers returning items shipped outside of the US will be responsible for all customs fees as well. Please read and fully understand the terms of our policy in advance if you wish to request a return.";
policy.ReturnsAcceptedOption="ReturnsAccepted";
policy.ShippingCostPaidByOption="Buyer";
The rest of the return policy displays as expected on the listing
To obtain the list of currently supported values, call GeteBayDetails with DetailName set to ReturnPolicyDetails. Then, look for the list of restocking fee percentage values in the ReturnPolicyDetails.RestockingFeeValue containers in the response.
https://developer.ebay.com/devzone/xml/docs/reference/ebay/types/ReturnPolicyType.html
I fetched an item listed using our old listing method and looked through the API call log to see the XML format of the existing listing.
I noticed a tag SellerReturnProfile inside of a tag SellerProfiles
I was able to populate the tags in the additem call like so
item.SellerProfiles = new SellerProfilesType();
var returnpolicy = new SellerReturnProfileType();
returnpolicy.ReturnProfileID = 63410125011;
returnpolicy.ReturnProfileName = "Returns Accepted,Buyer,30 Days,Money Default";
item.SellerProfiles.SellerReturnProfile = returnpolicy;
I had to list shipping profiles and payment profiles in the same way. It seems like if you list one seller profile the other 2 become required. In this case, the return profile was already defined in eBay as our default return profile.
They can be found in Account Settings -> Business Policies, but the id number has to be found with a getitem call on an existing item with the profile set.
It seems like the other call method ReturnPolicyType() might be depreciated as per these two sources
Business Policies Opt-In out soon to be enforced
Mapping Business Policies Management API Fields to Trading API Fields
Any seller who is opted into Business Policies will not be able to use the legacy fields at all, for Payment, Returns or Shipping in any new listing. If legacy fields are passed into the request, they will be ignored and dropped and the seller may get a warning message to that effect.
and
If you pass in Business Policies profile IDs and the legacy fields, the legacy fields will be ignored and dropped.
okay, it seems that no one is explaining the process of this issue completely, even kentico's documentations are not well organized and clear. My problem is that i have more than 50 records in a table in SQL which i would like to load in a single ASP dropdown list (because it would be a bad practice to fill it statically), and I am new to kentico so my problem is that I need a complete explanation about the process from A to Z, from building the query in kentico, to using it in visual. please post some examples if possible.
also please note that i have seen many examples like this one:
https://docs.kentico.com/k10/custom-development/developing-web-parts/advanced-web-part-development-scenarios/developing-custom-filters
but these examples are showing us only the last step, which is using DepartmentInfoProvider.GetDepartments(); to fill the dropdownlist, my main focus is to know how and where and using what they created the DepartmentInfoProvider class on the first place.
you should read about creating custom modules. There is a section how to add a class to the module. As soon as you add a class to the module, you'll be able to generate its Info and InfoProvider class, then add these files to solution and use them.
Farah, Another person asked a similar question:
https://devnet.kentico.com/questions/custom-filter-with-a-drop-down-list-from-the-databse
This will help give a little info on the Info and InfoProviders in Kentico
To be more specific to your needs though, you can use the QueryInfoProvider.ExecuteQuery to use a custom Kentico query that selects from your table, OR you can as Anton suggested make a custom module, but if you're new to Kentico this may be a bit much for you.
Lastly, if you want i have a universal filter webpart (just haven't published it yet) which gives you the ability to simply write a SQL query and then define how that selected value affects your repeater (you design the WHERE condition). Just tell me if you want it.
The solution was far more simple than I thought, First we should create a Query in Page Type --> Queries --> new Query --> specify queryName and queryText, the query gets the data from database, second in visual we have to write:
using System.Data;
private void initializeDropDownList(String queryName, String rowName, DropDownList dd)
{
List<String> listData = new List<String>();
DataSet dataset = new DataQuery("custom.PageType." + queryName).Execute();
foreach (DataRow row in dataset.Tables[0].Rows)
{
listData.Add(row[rowName].ToString());
}
String[] arrayData = listData.ToArray();
foreach (String data in arrayData)
{
if (data.Equals("")) { continue; }
else
{
dd.Items.Add(new ListItem(data));
}
}
}
I already set up DocumentDb and uploaded the documents to DocumentDb.
My JSON documents have data nested upto 4 levels, eg:-
{
id: '12345',
properties:
{
Accessories:
{
watch:1,
WristBands: [{
blue:1,
red: 2}]
}
}
Name: Leo,
Age: 24
}
I want to use azure search service for able to search upto the last level(e.g. The count of wristband colour i.e. blue:1). I have setup the service as well.
I want some help in creating the index and the indexer for such nested data in C# so that I can query the service.
Already found, how to use DataType.Collection(DataType.String), but this supports till level 2.
Classes can also be made for each sub-level but have no idea how to define them during indexing. Refered to example https://github.com/Azure-Samples/search-dotnet-getting-started .
One more tutorial on setting up Azure Search indexer for DocumentDB: https://azure.microsoft.com/en-us/documentation/articles/documentdb-search-indexer/.
+1 on Kirk Evans' blog post, which shows how to flatten the JSON document. The idea is to leverage the optional query property under container in the data source creation request, and use a join query in that place.
Unfortunately, Azure Search does not support nested documents. As you can see from our Uservoice page, this by far the most requested feature so it is something that we are very interested in adding (please cast your vote here if you don't mind). Unfortunately, we do not yet have a timeline on when we will have it implemented yet.
In the meantime, for some applications it is realistic to either flatten the JSON documents or to leverage collection types. For more details on flattening documents, Kirk Evans has a really good blog post on the topic.
I'm looking for a way to set the _CheckinComment. If i try It like this:
Microsoft.SharePoint.Client.File myUploadFile = myList.RootFolder.Files.Add(fileCreationInformation);
ListItem myItem = myUploadFile.ListItemAllFields;
myItem["Title"] = Path.GetFileName(sDocPath);
myItem["_CheckinComment"] = "This is the comment";
myClientContext.Load(myItem);
myClientContext.Load(myUploadFile);
myClientContext.ExecuteQuery();
I get Microsoft.SharePoint.Client.ServerException: Invalid data has been used to update the list item. The field you are trying to update may be read only.
I want to change the _CheckinComment (InternalName) and not this:
myUploadFile.CheckIn("This is the comment", CheckinType.OverwriteCheckIn)
Who can help?
Per Microsoft, "_CheckinComment" is a read-only server field. So, that explains your error.
Although you didn't specify what you are attempting to do, I think I know as I had my own problem related to this. I think you were annoyed that you couldn't put a check-in comment on upload...and when you use the checkin() method it creates a new version. So, your upload spans two versions (the first is the upload itself with no check-in comment and the second is the addition of the check-in comment)--kind of messy.
The key for me was to use the Publish(string) [https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.file.publish.aspx] and Unpublish(string) methods. This allows you to set the check-in comment for the current file while promoting/demoting the current version to a major of minor. Assuming your document library has major and minor versions, you can apply it as follows:
Upload -> Publish(strComment) to create a major version with comment
Upload -> Publish("") -> Unpublish(strComment) to create a minor version with a comment.
I am utilizing Devexpress Gridview and I am having a caching problem.
I have developed a page like here: http://mvc.devexpress.com/GridView/SimpleCustomBinding
It is working as it is supposed to be. However, if I update a column value in the database (Mssql), Gridview does not change the value.
Searched the web and found EnableRowsCache must be false but I could not implemented it since I think this property is available for different kind (or version) of Gridview and We have been using MVC extensions.
Does anybody know how to disable cache and make it show the "fresh" data?
------ UPDATE ------
After a lot of digging and searching, it is clear now that the caching is not due to devexpress, but it is the result of linq to sql. It is a property of linq that it caches the results of view and does not show the updated value.
This issue was a major headheache to us and now I have come up with a conclusion with my colleague.
PROBLEM
First of all, suppose that you have a view in your db, name: ViewBook
ViewBook
Id | Title | Author
And you write the following query:
(from VB in Connection.ViewBook
select VB).ToList();
As a result you will get a list of rows.
Then, if you update a row in your db, this query will not show the fresh data, still returns the old data.
SOLUTION
In order to solve this, first define an object:
public class ViewBookObject : ViewBook
{
//this object will have all the properties of ViewBook.
}
then in the query:
(from VB in Connection.ViewBook
select new ViewBookObject {
Id = VB.Id,
Title = VB.Title,
Author = VB.Author
}).ToList();
This query will always show the fresh data.
CONCLUSION
I have written this solution to here for people who have similar problem to this situation.
I hope this helps everyone.