-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SharePoint new types and model updates, List export method introduced
- Loading branch information
Showing
38 changed files
with
626 additions
and
23 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,19 @@ | ||
""" | ||
Demonstrates how to get a drive for a user. | ||
""" | ||
|
||
from office365.graph_client import GraphClient | ||
from tests import ( | ||
test_client_id, | ||
test_client_secret, | ||
test_tenant, | ||
test_user_principal_name, | ||
) | ||
|
||
client = GraphClient.with_client_secret(test_tenant, test_client_id, test_client_secret) | ||
site = ( | ||
client.users.get_by_principal_name(test_user_principal_name) | ||
.get_my_site() | ||
.execute_query() | ||
) | ||
print("Drive url: {0}".format(site.web_url)) |
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,25 @@ | ||
import os | ||
import tempfile | ||
|
||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.files.file import File | ||
from office365.sharepoint.listitems.listitem import ListItem | ||
from tests import test_client_credentials, test_team_site_url | ||
|
||
|
||
def print_progress(item): | ||
# type: (ListItem|File) -> None | ||
if isinstance(item, ListItem): | ||
print("List Item has been exported...") | ||
else: | ||
print("File has been downloaded...") | ||
|
||
|
||
ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials) | ||
|
||
list_title = "Orders" | ||
lib = ctx.web.lists.get_by_title(list_title) | ||
export_path = os.path.join(tempfile.mkdtemp(), "{0}.zip".format(list_title)) | ||
with open(export_path, "wb") as f: | ||
lib.export(f, True, print_progress).execute_query() | ||
print("List has been export into {0} ...".format(export_path)) |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,41 @@ | ||
from office365.onedrive.sites.site import Site | ||
from office365.runtime.paths.resource_path import ResourcePath | ||
from office365.runtime.paths.service_operation import ServiceOperationPath | ||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.entity import Entity | ||
from office365.sharepoint.webs.web import Web | ||
|
||
|
||
class AppContextSite(Entity): | ||
""" """ | ||
|
||
def __init__(self, context, site_url): | ||
# type: (ClientContext, str) -> None | ||
"""""" | ||
static_path = ServiceOperationPath( | ||
"SP.AppContextSite", | ||
{"siteUrl": site_url}, | ||
) | ||
super(AppContextSite, self).__init__(context, static_path) | ||
|
||
@property | ||
def site(self): | ||
"""""" | ||
return self.properties.get( | ||
"Site", | ||
Site( | ||
self.context, | ||
ResourcePath("Site", self.resource_path), | ||
), | ||
) | ||
|
||
@property | ||
def web(self): | ||
"""""" | ||
return self.properties.get( | ||
"Web", | ||
Web( | ||
self.context, | ||
ResourcePath("Web", self.resource_path), | ||
), | ||
) |
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
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,25 @@ | ||
from typing import Optional | ||
|
||
from office365.sharepoint.changes.change import Change | ||
|
||
|
||
class ChangeView(Change): | ||
"""Specifies a change on a view.""" | ||
|
||
@property | ||
def view_id(self): | ||
# type: () -> Optional[str] | ||
"""Identifies the changed view.""" | ||
return self.properties.get("ViewId", None) | ||
|
||
@property | ||
def list_id(self): | ||
# type: () -> Optional[str] | ||
"""Identifies the list that contains the changed view.""" | ||
return self.properties.get("ListId", None) | ||
|
||
@property | ||
def web_id(self): | ||
# type: () -> Optional[str] | ||
"""Identifies the site that contains the changed view.""" | ||
return self.properties.get("WebId", None) |
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,5 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class DirectoryObjectChanges(ClientValue): | ||
""" """ |
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,9 @@ | ||
from office365.runtime.client_value import ClientValue | ||
|
||
|
||
class DirectorySessionData(ClientValue): | ||
|
||
@property | ||
def entity_type_name(self): | ||
# type: () -> str | ||
return "SP.Directory.Provider.DirectorySessionData" |
Oops, something went wrong.