Closed farukcan closed 1 year ago
@farukcan I believe the property key for title of page should be title
lower-case.
I tried to see if I could produce the issue but I was able to update the title of the page.
var pagesCreateParameters = PagesCreateParametersBuilder
.Create(new ParentPageInput() { PageId = _databaseId })
.AddProperty("title",
new TitlePropertyValue
{
Title = new List<RichTextBase>
{
new RichTextTextInput { Text = new Text { Content = "Test Page Title" } }
}
}).Build();
var page = await _client.Pages.CreateAsync(pagesCreateParameters);
var updatePage = new PagesUpdateParameters()
{
Properties = new Dictionary<string, PropertyValue>
{
{
"title",
new TitlePropertyValue()
{
Title = new List<RichTextBase>
{
new RichTextText { Text = new Text() { Content = "Page Title Updated" } }
}
}
}
}
};
// Update
var updatedPage = await _client.Pages.UpdateAsync(page.Id, updatePage);
// Verify
var titleProperty = (ListPropertyItem)await _client.Pages.RetrievePagePropertyItemAsync(
new RetrievePropertyItemParameters
{
PageId = updatedPage.Id,
PropertyId = updatedPage.Properties["title"].Id
}
);
Assert.Equal("Page Title Updated", titleProperty.Results.First().As<TitlePropertyItem>().Title.PlainText);
// Clean Up
await _client.Pages.UpdateAsync(page.Id, new PagesUpdateParameters { Archived = true });
Note: Notion doesn't allow you to create title with custom key name it has to be title
- it is case sensitive.
stale - feel free to reopn
Doesnt work without error:
Also doesnt work without error:
Static function for fixing bad readibility