Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #27 from fatfingers23/master
Browse files Browse the repository at this point in the history
Office 365 Support by Username/password
  • Loading branch information
jasonrollins committed Jul 27, 2018
2 parents 00ecb30 + 452bbf9 commit 8750c0b
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 155 deletions.
18 changes: 17 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,30 @@ Usage
sp_list = site.List('list name')
data = sp_list.GetListItems('All Items', rowlimit=200)

Authenticate to Office365 Sharepoint
------------------------------------

::

from shareplum import Site
from shareplum import Office365

authcookie = Office365('https://abc.sharepoint.com', username='username@abc.com', password='password').GetCookies()
site = Site('https://abc.sharepoint.com/sites/MySharePointSite/', authcookie=authcookie)
sp_list = site.List('list name')
data = sp_list.GetListItems('All Items', rowlimit=200)



Features
--------

- Reading and writing data to SharePoint lists using Python Dictionaries.
- Automatic conversion between SharePoint internal names and displayed names.
- Using Queries to filter data when retrieving List Items.
- Automatic conversion of data types.
- Supports Users datatype
- Supports Users datatype.
- Supports Office365 Sharepoint sites.

Documentation
-------------
Expand Down
15 changes: 14 additions & 1 deletion docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@
Tutorial
========

On Premise Authentication
==========================
Getting started is easy. Just create some credentials you will use to connect to SharePoint with HttpNtlmAuth and pass the url and credentials to the Site object. ::

from shareplum import Site
from requests_ntlm import HttpNtlmAuth

cred = HttpNtlmAuth('Username', 'Password')
site = Site('https://mysharepoint.server.com/sites/MySite', auth=cred)

Office 365 Authentication
==========================
For Office 365 Sharepoint is just as easy. The Office365 class grabs a login token from Microsoft's login servers then It logins the Sharepoint site and uses the cookie for Authentication. Make sure to put just the root url for the site in Office365 and add Https:// at start. ::

from shareplum import Site
from shareplum import Office365

authcookie = Office365('https://abc.sharepoint.com', username='username@abc.com', password='password').GetCookies()
site = Site('https://abc.sharepoint.com/sites/MySharePointSite/', authcookie=authcookie)


Add A List
==========
Expand Down Expand Up @@ -54,3 +66,4 @@ You can update data in a SharePoint List easily as well. You just need the ID n
update_data = [{'ID': '1', 'Title': 'My Changed Title'},
{'ID': '2', 'Title': 'Another Change'}]
new_list.UpdateListItems(data=update_data, kind='Update')

0 comments on commit 8750c0b

Please sign in to comment.