The answer is you simply need to call e.Url.StartAccessingSecurityScopedResource();
Then call e.Url.StopAccessingSecurityScopedResource(); when done
private void DocumentPicker_DidPickDocument(object sender, UIDocumentPickedEventArgs e)
{
var documentUrl = e.Url;
// Check if the document can be accessed (sandbox security)
bool isSecured = documentUrl.StartAccessingSecurityScopedResource();
if (isSecured)
{
// Access the document here
// Once done, release the resource
documentUrl.StopAccessingSecurityScopedResource();
}
else
{
// Handle permission denial or failure to access
Console.WriteLine("Could not access the document.");
}
}