add user.reassign_to in nb sample
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "scrolled": true
+ },
"outputs": [
{
"data": {
" for item in folderitems:\n",
" item.reassign_to(new_userid, target_folder=folder['title'])"
]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "If the goal is reassign all the groups and items permanently then it is best to use the reassign_to method that can be found on the user itself. Instead of iterating through each folder and item, the call will be executed once and all the groups along with all the items of a user are reassigned to the indicated user. \n",
+ "Items are transferred to the new user into a folder named <user>_<folder> where user corresponds to the old user whose items were moved and folder corresponds to the folder that was moved."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "True\n"
+ ]
+ }
+ ],
+ "source": [
+ "olduser.reassign_to(target_username=newuser)"
+ ]
}
],
"metadata": {
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.7.9"
+ "version": "3.7.11"
}
},
"nbformat": 4,
