Search code examples
tridion

How to pass WebDavURL instead of TCM URI while creating a Component using Core Service?


I am able to create Components using Folder TCMURI as shown below:

var schemaInfo = client.ReadSchemaFields(
    "tcm:184-1882-8", true, new ReadOptions());

ComponentData component = (ComponentData)client.GetDefaultData(
    ItemType.Component, "tcm:19-454-2");

Can I can pass WebDavURL instead of this TCMURI where I want to create Component?

Thanks in advance.


Solution

  • You should simply use the WebDAV URL instead of the TCM URI:

    string folderWebDAVURL = "/webdav/MyPublication/Path/To/Folder";
    
    ComponentData component = (ComponentData)client.GetDefaultData(
        ItemType.Component, folderWebDAVURL);