-
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
473 additions
and
197 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
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 @@ | ||
""" | ||
List sharing permissions on a driveItem | ||
https://learn.microsoft.com/en-us/graph/api/driveitem-list-permissions?view=graph-rest-1.0 | ||
""" | ||
|
||
from office365.graph_client import GraphClient | ||
from tests import test_client_id, test_password, test_tenant, test_username | ||
|
||
client = GraphClient.with_username_and_password( | ||
test_tenant, test_client_id, test_username, test_password | ||
) | ||
file_path = "Archive/Financial Sample.xlsx" | ||
file_item = client.me.drive.root.get_by_path(file_path) | ||
permissions = file_item.permissions.get().execute_query() | ||
print(permissions) |
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,95 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 31, | ||
"id": "initial_id", | ||
"metadata": { | ||
"collapsed": true, | ||
"ExecuteTime": { | ||
"end_time": "2024-02-11T10:23:26.221156714Z", | ||
"start_time": "2024-02-11T10:23:26.197964378Z" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from office365.sharepoint.client_context import ClientContext\n", | ||
"client_id = \"4b7eb3df-afc3-4b7d-ae1d-629f22a3fe42\" \n", | ||
"site_url = \"https://mediadev8.sharepoint.com\"\n", | ||
"tenant_name = \"mediadev8.onmicrosoft.com\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"outputs": [], | ||
"source": [ | ||
"ctx = ClientContext(site_url).with_interactive(tenant_name, client_id)" | ||
], | ||
"metadata": { | ||
"collapsed": false, | ||
"ExecuteTime": { | ||
"end_time": "2024-02-11T10:23:27.733534468Z", | ||
"start_time": "2024-02-11T10:23:27.725507872Z" | ||
} | ||
}, | ||
"id": "b5504d6537baaebd", | ||
"execution_count": 32 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": "[email protected]" | ||
}, | ||
"execution_count": 34, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"me = ctx.web.current_user.get().execute_query()\n", | ||
"me" | ||
], | ||
"metadata": { | ||
"collapsed": false, | ||
"ExecuteTime": { | ||
"end_time": "2024-02-11T10:23:36.770634654Z", | ||
"start_time": "2024-02-11T10:23:36.520379564Z" | ||
} | ||
}, | ||
"id": "e61a0947e8ef00d5", | ||
"execution_count": 34 | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"outputs": [], | ||
"source": [], | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"id": "403e49d95b83b674" | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
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,49 @@ | ||
from faker import Faker | ||
|
||
from office365.sharepoint.client_context import ClientContext | ||
from tests import test_team_site_url, test_user_credentials | ||
|
||
|
||
def print_progress(items_count): | ||
print("{0} list items has been created".format(items_count)) | ||
|
||
|
||
def load_data_source(amount=1000): | ||
fake = Faker() | ||
contacts = [] | ||
for idx in range(0, amount): | ||
contact = { | ||
"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()}, | ||
} | ||
contacts.append(contact) | ||
|
||
return contacts | ||
|
||
|
||
def run(context): | ||
# type: (ClientContext) -> None | ||
contacts_data = load_data_source() | ||
contacts_list = context.web.lists.get_by_title("Contacts_Large") | ||
for idx, contact in enumerate(contacts_data): | ||
# contact_item = contacts_list.add_item(contact).execute_query() | ||
contacts_list.add_item(contact) | ||
# print( | ||
# "({0} of {1}) Contact '{2}' has been created".format( | ||
# idx, len(contacts_data), contact_item.properties["Title"] | ||
# ) | ||
# ) | ||
ctx.execute_batch(items_per_batch=2, success_callback=print_progress) | ||
|
||
|
||
if __name__ == "__main__": | ||
ctx = ClientContext(test_team_site_url).with_credentials(test_user_credentials) | ||
run(ctx) |
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,19 @@ | ||
from office365.sharepoint.client_context import ClientContext | ||
from office365.sharepoint.listitems.collection import ListItemCollection | ||
from office365.sharepoint.listitems.listitem import ListItem | ||
from tests import test_client_credentials, test_team_site_url | ||
|
||
|
||
def print_progress(items): | ||
# type: (ListItemCollection) -> None | ||
print("Items read: {0}".format(len(items))) | ||
|
||
|
||
ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials) | ||
large_list = ctx.web.lists.get_by_title("Contacts_Large") | ||
paged_items = ( | ||
large_list.items.paged(5000, page_loaded=print_progress).get().execute_query() | ||
) | ||
for index, item in enumerate(paged_items): # type: int, ListItem | ||
pass | ||
# print("{0}: {1}".format(index, item.id)) |
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,2 @@ | ||
numpy | ||
pandas |
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,8 @@ | ||
from office365.entity import Entity | ||
|
||
|
||
class AuthenticationMethodModeDetail(Entity): | ||
""" | ||
The details of the authenticationMethodModes objects that can be defined for the allowedCombinations property | ||
of the authenticationstrengthpolicy. | ||
""" |
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.entity import Entity | ||
|
||
|
||
class AuthenticationMethodTarget(Entity): | ||
"""""" |
Oops, something went wrong.