1
- Folders
2
- =======
1
+ # Folders
3
2
4
3
Folder objects represent a folder from a user's account. They can be used to
5
4
iterate through a folder's contents, collaborate a folder with another user or
6
5
group, and perform other common folder operations (move, copy, delete, etc.).
7
6
8
- * [ Get the User's Root Folder] ( #get-the-users-root-folder )
9
- * [ Get a Folder's Items] ( #get-a-folders-items )
10
- * [ Get a Folder's Information] ( #get-a-folders-information )
11
- * [ Update a Folder's Information] ( #update-a-folders-information )
12
- * [ Create a Folder] ( #create-a-folder )
13
- * [ Copy a Folder] ( #copy-a-folder )
14
- * [ Move a Folder] ( #move-a-folder )
15
- * [ Rename a Folder] ( #rename-a-folder )
16
- * [ Delete a Folder] ( #delete-a-folder )
17
- * [ Created a Shared Link for a Folder] ( #created-a-shared-link-for-a-folder )
18
- * [ Share a Folder] ( #share-a-folder )
19
- * [ Get All Collaborations for a Folder] ( #get-all-collaborations-for-a-folder )
20
-
21
- Get the User's Root Folder
22
- --------------------------
7
+ - [ Get the User's Root Folder] ( #get-the-users-root-folder )
8
+ - [ Get a Folder's Items] ( #get-a-folders-items )
9
+ - [ Get a Folder's Information] ( #get-a-folders-information )
10
+ - [ Update a Folder's Information] ( #update-a-folders-information )
11
+ - [ Create a Folder] ( #create-a-folder )
12
+ - [ Copy a Folder] ( #copy-a-folder )
13
+ - [ Move a Folder] ( #move-a-folder )
14
+ - [ Rename a Folder] ( #rename-a-folder )
15
+ - [ Delete a Folder] ( #delete-a-folder )
16
+ - [ Created a Shared Link for a Folder] ( #created-a-shared-link-for-a-folder )
17
+ - [ Share a Folder] ( #share-a-folder )
18
+ - [ Get All Collaborations for a Folder] ( #get-all-collaborations-for-a-folder )
19
+
20
+ ## Get the User's Root Folder
23
21
24
22
The user's root folder can be accessed with the static
25
23
` getRootFolder(BoxAPIConnection) ` method.
@@ -28,12 +26,11 @@ The user's root folder can be accessed with the static
28
26
BoxFolder rootFolder = BoxFolder . getRootFolder(api);
29
27
```
30
28
31
- Get a Folder's Items
32
- --------------------
29
+ ## Get a Folder's Items
33
30
34
- A call to ` getChildren() ` will return the contents of a ` BoxFolder ` . Optionally, an offset and limit
31
+ A call to ` getChildren() ` will return the contents of a ` BoxFolder ` . Optionally, an offset and limit
35
32
can be set to iterate over a large folder. Large folder operations will likely
36
- fail due to governor limits on callouts or heap size. This method could be detrimental depending
33
+ fail due to governor limits on callouts or heap size. This method could be detrimental depending
37
34
on your use case.
38
35
39
36
``` java
@@ -48,8 +45,7 @@ for (BoxItem.Info itemInfo : children) {
48
45
}
49
46
```
50
47
51
- Get a Folder's Information
52
- --------------------------
48
+ ## Get a Folder's Information
53
49
54
50
Calling ` getFolderInfo() ` on a folder returns a snapshot of the folder's
55
51
info.
@@ -59,22 +55,20 @@ BoxFolder folder = new BoxFolder(api, 'folder-id');
59
55
BoxFolder . Info info = folder. getFolderInfo();
60
56
```
61
57
62
- Update a Folder's Information
63
- -----------------------------
58
+ ## Update a Folder's Information
64
59
65
60
Updating a folder's information is done by creating a new ` BoxFolder.Info `
66
61
object or updating an existing one, and then calling
67
62
` updateFolderInfo(BoxFolder.Info) ` .
68
63
69
64
``` java
70
65
BoxFolder folder = new BoxFolder (api, ' folder-id' );
71
- BoxFolder . Info info = folder. new Info ();
66
+ BoxFolder . Info info = folder. getFolderInfo ();
72
67
info. addValue(' description' , ' Some folder I made' );
73
68
folder. updateFolderInfo(info);
74
69
```
75
70
76
- Create a Folder
77
- ---------------
71
+ ## Create a Folder
78
72
79
73
Create a child folder by calling ` createFolder(String) ` on the
80
74
parent folder.
@@ -84,8 +78,7 @@ BoxFolder parentFolder = new BoxFolder(api, 'parent-folder-id');
84
78
BoxFolder . Info childFolderInfo = parentFolder. createFolder(' Child Folder Name' );
85
79
```
86
80
87
- Copy a Folder
88
- -------------
81
+ ## Copy a Folder
89
82
90
83
Call the ` copy(BoxFolder) ` method to copy a folder to another folder.
91
84
@@ -105,8 +98,7 @@ BoxFolder destination = new BoxFolder(api, 'destination-folder-id');
105
98
folder. copy(destination, ' New Folder Name' );
106
99
```
107
100
108
- Move a Folder
109
- -------------
101
+ ## Move a Folder
110
102
111
103
Call the ` move(BoxFolder) ` method with the destination you want the folder moved
112
104
to.
@@ -119,8 +111,7 @@ folder.move(destination);
119
111
120
112
Similar to the ` copy ` method, the folder can be renamed by calling ` move(BoxFolder, String) ` .
121
113
122
- Rename a Folder
123
- ---------------
114
+ ## Rename a Folder
124
115
125
116
Call the ` rename(String) ` method with a new name for the folder.
126
117
@@ -141,8 +132,7 @@ info.addValue('name', 'New Folder Name');
141
132
folder. updateFolderInfo(info);
142
133
```
143
134
144
- Delete a Folder
145
- ---------------
135
+ ## Delete a Folder
146
136
147
137
A folder can be deleted with the ` deleteFolder(boolean) ` method. Passing
148
138
true to this method indicates that the folder and its contents should be
@@ -153,8 +143,7 @@ BoxFolder folder = new BoxFolder(api, 'folder-id');
153
143
folder. deleteFolder(true );
154
144
```
155
145
156
- Created a Shared Link for a Folder
157
- ----------------------------------
146
+ ## Created a Shared Link for a Folder
158
147
159
148
You can get a shared link for a folder by calling the
160
149
` createSharedLink(BoxSharedLink.Access, DateTime, BoxSharedLink.Permissions) ` method.
@@ -165,12 +154,11 @@ BoxSharedLink.Permissions permissions = new BoxSharedLink.Permissions();
165
154
BoxSharedLink . Info linkInfo = folder. createSharedLink(BoxSharedLink . Access . OPEN , null , permissions);
166
155
```
167
156
168
- Share a Folder
169
- --------------
157
+ ## Share a Folder
170
158
171
159
You can invite another person to collaborate on a folder with the
172
160
[ collaborate(String, BoxCollaboration.Role)` method. The Box user with the email address
173
- specified will receive a collaboration request. If the email is not associated with a Box
161
+ specified will receive a collaboration request. If the email is not associated with a Box
174
162
account, an invitation to create a Box account will be sent.
175
163
176
164
``` java
@@ -188,8 +176,7 @@ BoxFolder folder = new BoxFolder(api, 'folder-id');
188
176
BoxCollaboration . Info collabInfo = folder. collaborate(collaborator, BoxCollaboration . Role . EDITOR );
189
177
```
190
178
191
- Get All Collaborations for a Folder
192
- -----------------------------------
179
+ ## Get All Collaborations for a Folder
193
180
194
181
The ` getCollaborations() ` method will return a list
195
182
of ` BoxCollaboration.Info ` objects for a folder.
0 commit comments