Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > CRUD for custom document types View modes: 
User avatar
Member
Member
poplooukhin-gmail - 1/16/2014 11:34:39 AM
   
CRUD for custom document types
Hello, All

I can not find any sample for CRUD operations for custom document type.

I want to use Portal Engine for that.

Best regards

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 1/16/2014 1:35:21 PM
   
RE:CRUD for custom document types
The CRUD methods are the same for any document type (custom or not), you simply specify the "code name" you gave it when you created it. Take a look at the post here and the API Examples here. Below is a code sample for retrieving documents:
private bool GetAndUpdateDocuments()
{
// Create an instance of the Tree provider first
TreeProvider tree = new TreeProvider(CMSContext.CurrentUser);

// Fill dataset with documents
DataSet documents = tree.SelectNodes(CMSContext.CurrentSiteName, "/API-Example/%", "en-us", false, "CMS.MenuItem");

if (!DataHelper.DataSourceIsEmpty(documents))
{
// Loop through all documents
foreach (DataRow documentRow in documents.Tables[0].Rows)
{
// Create a new Tree node from the data row
TreeNode editDocument = TreeNode.New(documentRow, "CMS.MenuItem", tree);

string newName = editDocument.DocumentName.ToLower();

// Change coupled data
editDocument.SetValue("MenuItemName", newName);
// Change document data
editDocument.DocumentName = newName;

// Save to database
editDocument.Update();
}

return true;
}

return false;
}

User avatar
Member
Member
poplooukhin-gmail - 1/16/2014 4:16:09 PM
   
RE:CRUD for custom document types
Great thanks for your answers.
But I need to do crud for document types using web parts.
Portal Engine creates forms for adding and editing item of document type.
Also, Portal Engine provides ability to use repeaters for view data .

But I don't know how can I do crud for document type using portal engine of kentico cms

Best regards.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 1/16/2014 9:30:18 PM
   
RE:CRUD for custom document types
Have you read the documentation? I'd start out with the "Creating pages using the portal engine" section. This will show you how to add, update and delete document types to your content tree and display the content those document types hold.

User avatar
Member
Member
poplooukhin-gmail - 1/17/2014 2:36:18 AM
   
RE:CRUD for custom document types
FroggEye wrote: Have you read the documentation? I'd start out with the "Creating pages using the portal engine" section. This will show you how to add, update and delete document types to your content tree and display the content those document types hold.

I read documentation about managing by document types.
But I need to do CRUD for documents of my custom document types.
It will be good, If I can do it using Portal Engine.

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 1/17/2014 2:47:18 AM
   
RE:CRUD for custom document types
Hi,

Thank you for your message.

You can find API operation for CRUD in this section of developers guid -> http://devnet.kentico.com/docs/devguide/documents_api_overview.htm

You can also perform such operations inside CMS Desk -> Content for your particular documents.

Kind regards,
Richard Sustek

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 1/17/2014 6:20:29 AM
   
RE:CRUD for custom document types
poplooukhin-gmail wrote: I read documentation about managing by document types.
But I need to do CRUD for documents of my custom document types.
It will be good, If I can do it using Portal Engine.
"Custom" document types are really no different than the ones that are pre-installed. If you go through the UI and create a new document type, you can use all the pre-made webparts to access them through the UI. You might check out the "User Contribution" web part as well as the standard repeater. The repeater allows users to view, edit and delete items right off of the Edit page in the CMSDesk.