Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SharePoint namespace new types & methods (StorageMetrics, CustomActio…
…nElement), bug fixes: #307 - address file by server relative url
- Loading branch information
vvgrem@gmail.com
authored and
vvgrem@gmail.com
committed
Jan 7, 2021
1 parent
4999e19
commit 16d115f
Showing
20 changed files
with
209 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from office365.runtime.auth.client_credential import ClientCredential | ||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.fields.field_multi_user_value import FieldMultiUserValue | ||
from office365.sharepoint.fields.field_user_value import FieldUserValue | ||
from office365.sharepoint.lists.list_creation_information import ListCreationInformation | ||
from office365.sharepoint.lists.list_template_type import ListTemplateType | ||
from settings import settings | ||
from tests import random_seed | ||
|
||
credentials = ClientCredential(settings['client_credentials']['client_id'], | ||
settings['client_credentials']['client_secret']) | ||
ctx = ClientContext(settings.get('url')).with_credentials(credentials) | ||
|
||
list_title = "Tasks N%s" % random_seed | ||
list_create_info = ListCreationInformation(list_title, | ||
None, | ||
ListTemplateType.TasksWithTimelineAndHierarchy) | ||
|
||
tasks_list = ctx.web.lists.add(list_create_info).execute_query() | ||
current_user = ctx.web.current_user.get().execute_query() | ||
|
||
multi_user_value = FieldMultiUserValue() | ||
multi_user_value.add(FieldUserValue.from_user(current_user)) | ||
|
||
item_to_create = tasks_list.add_item({ | ||
"Title": "New Task", | ||
"AssignedTo": multi_user_value | ||
}).execute_query() | ||
|
||
|
||
multi_user_value_alt = FieldMultiUserValue() | ||
multi_user_value_alt.add(FieldUserValue(current_user.id)) | ||
|
||
item_to_create_alt = tasks_list.add_item({ | ||
"Title": "New Task 2", | ||
"AssignedTo": multi_user_value_alt | ||
}).execute_query() | ||
|
||
|
||
print(f"List item added into list {list_title}") |
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class CustomActionElement(ClientValue): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.sharepoint.base_entity import BaseEntity | ||
|
||
|
||
class UserCustomAction(BaseEntity): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
office365/sharepoint/listitems/list_Item_form_update_value.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class ListItemFormUpdateValue(ClientValue): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.sharepoint.base_entity import BaseEntity | ||
|
||
|
||
class StorageMetrics(BaseEntity): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class PrincipalInfo(ClientValue): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class UploadStatus(ClientValue): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class WopiProperties(ClientValue): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class WopiWebAppProperties(ClientValue): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from office365.sharepoint.files.file import File | ||
from office365.sharepoint.lists.list import List | ||
from tests.sharepoint.sharepoint_case import SPTestCase | ||
|
||
|
||
class TestPages(SPTestCase): | ||
pages_list = None # type: List | ||
target_file = None # type: File | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
super(TestPages, cls).setUpClass() | ||
|
||
def test1_ensure_site_pages_library(self): | ||
pages_list = self.client.web.lists.ensure_site_pages_library().execute_query() | ||
self.assertIsNotNone(pages_list.resource_path) | ||
self.__class__.pages_list = pages_list | ||
|
||
def test2_create_wiki_page(self): | ||
page_name = "WelcomeWikiPage.aspx" | ||
result = self.__class__.pages_list.create_wiki_page(page_name, "Wiki content") | ||
self.client.execute_query() | ||
self.assertIsNotNone(result.value) | ||
self.__class__.target_file = result.value | ||
|
||
def test3_delete_page(self): | ||
self.__class__.target_file.delete_object().execute_query() |