# Check item type (clip, bin, folder, file)

**URL:** <https://forums.creativeclouddeveloper.com/t/check-item-type-clip-bin-folder-file/9197>\
**Category:** Premiere Pro\
**Tags:** uxp\
**Created:** [February 7, 2025, 6:59pm UTC](https://forums.creativeclouddeveloper.com/t/check-item-type-clip-bin-folder-file/9197 "2025-02-07T18:59:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![birdofscript](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/birdofscript/32/4300_2.png) [@birdofscript](https://forums.creativeclouddeveloper.com/u/birdofscript)\
**Post date:** [February 7, 2025, 6:59pm UTC](https://forums.creativeclouddeveloper.com/t/check-item-type-clip-bin-folder-file/9197/1 "2025-02-07T18:59:36Z")

</div>

Hello,  
I have a code snippet that reads the items in the root of my project.  
However, **it does not display the folders** that exist there.

I’m not sure if the code is suitable for determining the **item type**.

```auto
var activeProject = await app.Project.getActiveProject();
var rootItem = await activeProject.getRootItem();
var items = await rootItem.getItems();

for (const item of items) {
    let eachItem = await app.ClipProjectItem.cast(item);
    if (eachItem ){

        // Code to read the item type. Is it correct?
        let content = await eachItem.getContentType();

        console.log("eachItem : ", eachItem.name);
        console.log("content: ", content); // Is the value of "content" the media type? 1, 2?
    }
}

```

And… How do I differentiate between _CLIP BIN ROOT_ and _FILE_ ([available on CEP panels](https://ppro-scripting.docsforadobe.dev/item/projectitem/#projectitemtype))?

Thank you in advance 😊  
Joan

---

<div class="post-metadata">

**Author:** ![CathyDong](https://avatars.discourse-cdn.com/v4/letter/c/a8b319/32.png) [@CathyDong](https://forums.creativeclouddeveloper.com/u/CathyDong)\
**Post date:** [February 10, 2025, 10:16pm UTC](https://forums.creativeclouddeveloper.com/t/check-item-type-clip-bin-folder-file/9197/2 "2025-02-10T22:16:15Z")

</div>

`getContentType` is helpful for differentiating between `ClipProjectItem` content type, like if it is a sequence, media, and other kind.

You can use `console.log(app.Constants.ContentType)` to access the definition. 2 refers to Sequence and 1 refers to Media.

Your code does not display the folders because `FolderItem` cannot be casted be `ClipProjectItem`. Following code will help differentiate between `CLIP` and `BIN` item:

```auto
for (const item of items) {
    let eachItem = await app.ClipProjectItem.cast(item);
    if (eachItem){

        // Code to read the item content type. 
        let content = await eachItem.getContentType();

        console.log("eachItem : ", eachItem.name);
        console.log("content: ", content); // 1 = media, 2 = sequence
    }
    else{
        // see if it's folderItem
        let folderItem = app.FolderItem.cast(item);
        if (folderItem){
            console.log("folderItem : ", folderItem.name); // display folder name
        }
    }
}

```

Unfortunately, there is no API to directly access projectItem type like CEP does at this point. However, the workaround is to check if `projectItem` can be casted to `ClipProjectItem` (`CLIP`) or `FolderItem` (`BIN`). If it can’t be casted to both, it is a `FILE` item. If you see a projectItem can be casted to `FolderItem` and its name is the same as project name, it’s likely the `ROOT` item unless user have named some of the bin the same as the project.

Thanks for trying out UXP!

---

<div class="post-metadata">

**Author:** ![birdofscript](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/birdofscript/32/4300_2.png) [@birdofscript](https://forums.creativeclouddeveloper.com/u/birdofscript)\
**Post date:** [February 11, 2025, 12:01pm UTC](https://forums.creativeclouddeveloper.com/t/check-item-type-clip-bin-folder-file/9197/3 "2025-02-11T12:01:29Z")

</div>

> [@CathyDong](#):
>
> `console.log(app.Constants.ContentType)`

Very nice trick!  
Thank you very much for the detailed explanations. They help a lot in understanding how _UXP_ works.
