<jupyter_start><jupyter_text>Title: GeoBC DSS AGO Project Groups Creation  Author: <NAME>(<EMAIL>)  Purpose: Create two groups(VIEW AND EDIT) for new AGO project in DSS Proxy Account.    Update info:    Jan 4, 2021.     Feb 2, 2021: ESRI Group 'create' function has bugs. it does not work. change it to 'create_from_dict'.************************************************************************************************************************** ![tempCapture.PNG](attachment:tempCapture.PNG) ![tempCapture2.PNG](attachment:tempCapture2.PNG)  Import modules and connect AGO account<jupyter_code>import arcgis
from IPython.display import display
url = 'http://www.arcgis.com'
username = 'PX.GeoBC.DSS.Creator'

password = arcpy.GetParameterAsText(0)
gis = arcgis.GIS(url, username, password)<jupyter_output><empty_output><jupyter_text>Define  tool paramerters and group dictionaries<jupyter_code>group_title = arcpy.GetParameterAsText(1)
group_tag = arcpy.GetParameterAsText(2)
group_description = arcpy.GetParameterAsText(3)
group_snippet = arcpy.GetParameterAsText(4)
View_group_Boolean = arcpy.GetParameterAsText(5)
edit_group_title = 'GeoBC - DSS - ' + group_title + ' - Edit'
view_group_title = 'GeoBC - DSS - ' + group_title + ' - View'

edit_group_dict ={'title':edit_group_title,'tags':group_tag,
            'description':group_description,'snippet':group_snippet,
            'isViewOnly':'False','access':'org', 'isInvitationOnly':'False',
             'sortField':'title', 'sortOrder':'asc',
             'capabilities':'updateitemcontrol'
            }


view_group_dict ={'title':view_group_title,'tags':group_tag,
            'description':group_description,'snippet':group_snippet,
            'isViewOnly':'False','access':'org', 'isInvitationOnly':'False',
             'sortField':'title', 'sortOrder':'asc'
             #'capabilities':'updateitemcontrol'
            }


    
if str(View_group_Boolean) == 'true':
    arcpy.AddMessage("Only create project VIEW group.")
    view_group = gis.groups.create_from_dict(view_group_dict)
    #print("Group {} View has created.".format(group_title))
    arcpy.AddMessage("Group {} View has created.".format(view_group_title))
    view_group.protected = True  # set the group can not be deleted by accident.!!!!!!!!!!!
    


else:
    view_group = gis.groups.create_from_dict(view_group_dict)
    print("Group {} View has created.".format(view_group_title))
    arcpy.AddMessage("Group {} View has created.".format(view_group_title))
    view_group.protected = True  # set the group can not be deleted by accident.
    
    edit_group = gis.groups.create_from_dict(edit_group_dict)
    print("Group {} Edit has been created.".format(edit_group_title))
    arcpy.AddMessage("Group {} Edit has been created.".format(edit_group_title))
    edit_group.protected = True  # set the group can not be deleted by accident.<jupyter_output><empty_output><jupyter_text>Create a folder in DSS Proxy Account<jupyter_code>##### Create a folder in DSS Proxy account(PX.GeoBC.DSS.Creator)
gis.content.create_folder(folder = 'DSS ' + group_title)
print("Folder {} has been created.".format(group_title))
arcpy.AddMessage("Folder {} Edit has been created.".format(group_title))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15876923076923077, 'fraction_numerical': 0.005538461538461538, 'mean_word_length': 5.020370370370371, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '654965', 'license': 'Apache-2.0', 'n_tokens_mistral': 1039, 'n_tokens_neox': 991, 'n_words': 207, 'path': 'recipes/ArcGIS_API_Python/Administration/GeoBC_DSS_AGO_Group_Creation_Updated.ipynb', 'repo_name': 'danagerous/gis-pantry', 'size': '3267'}