---
# System prepended metadata

title: IContent v.s. IPublishedContent

---

# IContent v.s. IPublishedContent


* Icontent getting Service 宣告
* Icontent 抓取節點
* Icontent 抓特定的檔案型態
* Icontent 能抓取所有資料(已發佈及未發佈的)
``` csharp=
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Services;

IContentService contentService = ApplicationContext.Services.ContentService;
IContent rootNode = contentService.GetById(15226);
var dataList = rootNode.Children().Where(x => x.ContentType.Alias == "LP");
var publishedDataList = rootNode.Children().Where(x => x.Published);
var unpublishedDataList = rootNode.Children().Where(x => !(x.Published));
```

* IPublishedContent 抓取節點
* IPublishedContent 抓特定檔案型態
* IPublishedContent 只抓已發佈的資料
```csharp=
IPublishedContent rootNode = Umbraco.TypedContent(15226);
var dataList = rootNode.Children().Where(x => x.IsDocumentType("LP"));

```