Share via


DocumentsContract.BuildDocumentUriUsingTree(Uri, String) Method

Definition

Build URI representing the target Document#COLUMN_DOCUMENT_ID in a document provider.

[Android.Runtime.Register("buildDocumentUriUsingTree", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;", "")]
public static Android.Net.Uri? BuildDocumentUriUsingTree (Android.Net.Uri? treeUri, string? documentId);
[<Android.Runtime.Register("buildDocumentUriUsingTree", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/net/Uri;", "")>]
static member BuildDocumentUriUsingTree : Android.Net.Uri * string -> Android.Net.Uri

Parameters

treeUri
Uri

the subtree to leverage to gain access to the target document. The target directory must be a descendant of this subtree.

documentId
String

the target document, which the caller may not have direct access to.

Returns

Uri
Attributes

Remarks

Build URI representing the target Document#COLUMN_DOCUMENT_ID in a document provider. When queried, a provider will return a single row with columns defined by Document.

However, instead of directly accessing the target document, the returned URI will leverage access granted through a subtree URI, typically returned by Intent#ACTION_OPEN_DOCUMENT_TREE. The target document must be a descendant (child, grandchild, etc) of the subtree.

This is typically used to access documents under a user-selected directory tree, since it doesn't require the user to separately confirm each new document access.

Java documentation for android.provider.DocumentsContract.buildDocumentUriUsingTree(android.net.Uri, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also

  • ActionOpenDocumentTree
  • <xref:Android.Provider.DocumentsProvider.IsChildDocument(System.String%2c+System.String)>
  • <xref:Android.Provider.DocumentsContract.BuildDocumentUri(System.String%2c+System.String)>