-
-
Notifications
You must be signed in to change notification settings - Fork 371
Expand file tree
/
Copy pathcreate_wiki.py
More file actions
17 lines (12 loc) · 696 Bytes
/
create_wiki.py
File metadata and controls
17 lines (12 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""
Demonstrates how to create and delete a wiki page in the default document library.
See https://learn.microsoft.com/en-us/sharepoint/dev/apis/rest-api/navigation/file-operations
"""
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.pages.template_file_type import TemplateFileType
from tests import test_team_site_url, test_user_credentials
ctx = ClientContext(test_team_site_url).with_credentials(test_user_credentials)
parent_folder = ctx.web.default_document_library().root_folder
file_url = "WikiPage 123.aspx"
file = parent_folder.files.add_template_file(file_url, TemplateFileType.WikiPage).execute_query()
file.delete_object().execute_query()