csom – Can you add user to SharePoint list that is not a part of the sub-site the list is on?


I have a SharePoint list with a column that is type person or group. I am doing this all with a C# app using CSOM. (SharePoint foundation)

The list is located on SharePoint sub-site, one of the people I need to add cannot be found on that sub-site.

My current code for adding users:

editor = ctx.Web.EnsureUser(@namesAndEmails(record.Editor));
ctx.Load(editor);
oListItem("Owner") = owner;
oListItem("Editor0") = editor;
ctx.ExecuteQuery();

The list uses the contexts of the sub-site and that seems to be holding me back from adding a user not a part of the sub-site, is there a way around this?

Any help is appreciated, thank you.