Skip to content

Commit

Permalink
examples section updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrem committed Mar 28, 2023
1 parent 4a163e1 commit 3c637d5
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ The list of examples:
- Working with lists and list items
- [create a list item](examples/sharepoint/lists/data_generator.py)
- [read a list item](examples/sharepoint/lists/read_large.py)
- [update a list item](examples/sharepoint/listitems/update_items_batch.py)
- [delete a list item](examples/sharepoint/listitems/delete_list_item.py)
- [update a list item](examples/sharepoint/listitems/update_batch.py)
- [delete a list item](examples/sharepoint/listitems/delete.py)

Refer [examples section](examples/sharepoint) for another scenarios

Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions examples/sharepoint/listitems/read.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.listitems.listitem import ListItem
from tests import test_client_credentials, test_team_site_url

ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials)
tasks_list = ctx.web.lists.get_by_title("Company Tasks")
items = tasks_list.items.get().execute_query()
for item in items: # type:ListItem
print("{0}".format(item.properties.get("Title")))
11 changes: 11 additions & 0 deletions examples/sharepoint/listitems/read_with_props_alt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from office365.sharepoint.client_context import ClientContext
from office365.sharepoint.listitems.listitem import ListItem
from tests import test_client_credentials, test_team_site_url

ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials)
lib = ctx.web.lists.get_by_title("Documents")
items = lib.items
ctx.load(items, ["EncodedAbsUrl"])
ctx.execute_query()
for item in items: # type:ListItem
print("{0}".format(item.properties.get('EncodedAbsUrl')))
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import json

from office365.sharepoint.client_context import ClientContext
from tests import test_team_site_url, test_user_credentials

ctx = ClientContext(test_team_site_url).with_credentials(test_user_credentials)
result = ctx.group_site_manager.get_current_user_joined_teams().execute_query()
print(result.value)
data = json.loads(result.value)
for item in data["value"]:
print(item['displayName'])

0 comments on commit 3c637d5

Please sign in to comment.