-
-
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.
Sharing namespace improvements in SharePoint API, Intune new types
- Loading branch information
Showing
24 changed files
with
640 additions
and
69 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
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 |
---|---|---|
@@ -1 +1,9 @@ | ||
|
||
def upload_sample(context, path): | ||
""" | ||
:type context: office365.sharepoint.client_context.ClientContext | ||
:type path: str | ||
""" | ||
folder = context.web.default_document_library().root_folder | ||
with open(path, 'rb') as f: | ||
file = folder.files.upload(f).execute_query() | ||
return 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
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import json | ||
|
||
from examples.sharepoint import upload_sample | ||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.sharing.links.kind import SharingLinkKind | ||
from tests import test_user_credentials, test_team_site_url | ||
|
||
ctx = ClientContext(test_team_site_url).with_credentials(test_user_credentials) | ||
file_url = "/sites/team/Shared Documents/SharePoint User Guide.docx" | ||
target_file = ctx.web.get_file_by_server_relative_url(file_url) | ||
result = target_file.share_link(SharingLinkKind.OrganizationView).execute_query() | ||
remote_file = upload_sample(ctx, "../../data/Financial Sample.xlsx") | ||
result = remote_file.share_link(SharingLinkKind.OrganizationView).execute_query() | ||
print(json.dumps(result.value.to_json(), indent=4)) |
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,16 @@ | ||
""" | ||
""" | ||
import json | ||
|
||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.sharing.links.kind import SharingLinkKind | ||
from office365.sharepoint.sharing.role_type import RoleType | ||
from tests import test_user_credentials, test_team_site_url | ||
|
||
ctx = ClientContext(test_team_site_url).with_credentials(test_user_credentials) | ||
file_url = "Shared Documents/SharePoint User Guide.docx" | ||
target_file = ctx.web.get_file_by_server_relative_url(file_url) | ||
result = target_file.share_link(SharingLinkKind.Flexible, role=RoleType.Editor, password="password").execute_query() | ||
print(json.dumps(result.value.to_json(), indent=4)) | ||
# print("Shared link url: {0}".format(result.value.sharingLinkInfo)) |
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
Oops, something went wrong.