I’m working with the Notion API using the .NET SDK and I need to give external users access to specific pages by adding them via email. I’ve been trying to use the People property but I keep running into issues.
Here’s what I’m attempting:
var currentPage = await notionClient.Pages.RetrieveAsync(pageId);
currentPage.Properties.Add("collaborators", new PeoplePropertyValue()
{
Id = "Contributors",
People = userList.Results
});
await notionClient.Pages.UpdatePropertiesAsync(pageId, currentPage.Properties);
When the page has a database parent, I get this error:
Notion.Client.NotionApiException : collaborators is not a property that exists.
StatusCode: BadRequest
NotionApiErrorCode: InvalidJSON
For pages with page parents, the error is different:
Notion.Client.NotionApiException : body failed validation.
body.parent.database_id should be defined, instead was `undefined`.
body.properties.collaborators should be not present
I also tried creating new pages with people properties:
await notionClient.Pages.CreateAsync(new PagesCreateParameters()
{
Parent = new ParentPageInput { PageId = mainPageId },
Properties = new Dictionary<string, PropertyValue>
{
["title"] = new TitlePropertyValue
{
Title = new List<RichTextBase>()
{
new RichTextText(){ Text = new Text() { Content = pageTitle } }
}
},
["collaborators"] = new PeoplePropertyValue()
{
Id = "Contributors",
People = userList.Results
}
}
});
But this gives similar validation errors. Is there another approach to share pages with external users or modify access permissions for workspace members through the API?