Exemplo n.º 1
0
 def test_1_create_list(self):
     list_properties = ListCreationInformation()
     list_properties.AllowContentTypes = True
     list_properties.BaseTemplate = ListTemplateType.TasksWithTimelineAndHierarchy
     list_properties.Title = self.list_title
     list_to_create = self.context.web.lists.add(list_properties)
     self.context.execute_query()
     self.assertEqual(list_properties.Title, list_to_create.properties['Title'])
def generate_contacts(context):
    contacts_list = ensure_list(
        context.web,
        ListCreationInformation("Contacts_Large", None,
                                ListTemplateType.Contacts))

    fake = Faker()
    for idx in range(0, 100):
        contact_properties = {
            'Title': fake.name(),
            'FullName': fake.name(),
            'Email': fake.email(),
            'Company': fake.company(),
            'WorkPhone': fake.phone_number(),
            'WorkAddress': fake.street_address(),
            'WorkCity': fake.city(),
            'WorkZip': fake.postcode(),
            'WorkCountry': fake.country(),
            'WebPage': {
                'Url': fake.url()
            }
        }
        contact_item = contacts_list.add_item(contact_properties)
        context.execute_query()
        print("Contact '{0}' has been created".format(
            contact_item.properties["Title"]))
Exemplo n.º 3
0
 def setUpClass(cls):
     super(TestSPView, cls).setUpClass()
     cls.target_list = ensure_list(
         cls.client.web,
         ListCreationInformation("Tasks", None, ListTemplateType.Tasks))
     cls.target_view_title = "My Tasks %s" % random_seed
     cls.target_view_title_updated = cls.target_view_title + "_updated"
 def setUpClass(cls):
     super(TestSharePointFile, cls).setUpClass()
     cls.target_list = ensure_list(cls.client.web,
                                   ListCreationInformation(
                                       "Archive Documents N%s" % random_seed,
                                       None,
                                       ListTemplateType.DocumentLibrary))
Exemplo n.º 5
0
 def setUpClass(cls):
     super(TestListItemAttachment, cls).setUpClass()
     cls.target_list = ListExtensions.ensure_list(
         cls.context.web,
         ListCreationInformation("Tasks", None, ListTemplateType.Tasks))
     item_properties = {'Title': 'Approval Task'}
     cls.target_item = cls.target_list.add_item(item_properties)
     cls.context.execute_query()
 def setUpClass(cls):
     super(TestListItem, cls).setUpClass()
     cls.target_list = ListExtensions.ensure_list(
         cls.context.web,
         ListCreationInformation("Tasks", None, ListTemplateType.Tasks))
     cls.target_item_properties = {
         "Title": "Task %s" % random_seed,
         "Id": None
     }
Exemplo n.º 7
0
    def setUpClass(cls):
        super(_File, cls).setUpClass()
        try:
            cls.target_library = cls.context.web.lists.add(
                ListCreationInformation(cls.library_name, None, 101))
            cls.context.execute_query()
        except ValueError as e:
            cls.context.pending_request.clear()
            cls.target_library = cls.context.web.lists.get_by_title(
                cls.library_name)
            cls.context.execute_query()

            cls.target_library.delete_object()
            cls.context.execute_query()

            cls.target_library = cls.context.web.lists.add(
                ListCreationInformation(cls.library_name, None, 101))
            cls.context.execute_query()

        cls.context.load(cls.target_library)
        cls.context.execute_query()
 def setUpClass(cls):
     super(TestFile, cls).setUpClass()
     cls.target_list = ListExtensions.ensure_list(
         cls.context.web,
         ListCreationInformation("Archive Documents N%s" % random_seed,
                                 None, ListTemplateType.DocumentLibrary))
Exemplo n.º 9
0
 def setUpClass(cls):
     super(TestSharePointFolder, cls).setUpClass()
     cls.target_list = ListExtensions.ensure_list(
         cls.client.web,
         ListCreationInformation("Documents %s" % random_seed, None,
                                 ListTemplateType.DocumentLibrary))