@@ -51,12 +51,24 @@ There are **two approaches** available to perform API queries:
5151
5252 from office365.sharepoint.client_context import ClientContext
5353
54- ctx = ClientContext.connect_with_credentials(url, UserCredential(username, password))
54+ ctx = ClientContext(site_url).with_credentials( UserCredential(username, password))
5555 web = ctx.web
5656 ctx.load(web)
5757 ctx.execute_query()
5858 print "Web title: {0}".format(web.properties['Title'])
5959 ```
60+ or alternatively via method chaining (a.k.a Fluent Interface):
61+
62+ ```
63+
64+ from office365.sharepoint.client_context import ClientContext
65+
66+ ctx = ClientContext(site_url).with_credentials(UserCredential(username, password))
67+ web = ctx.web.load().execute_query()
68+ print "Web title: {0}".format(web.properties['Title'])
69+ ```
70+
71+
6072
61732 . ` RequestOptions class ` - where you construct REST queries (and no model is involved)
6274
@@ -70,7 +82,7 @@ from office365.runtime.auth.UserCredential import UserCredential
7082from office365.runtime.http.request_options import RequestOptions
7183from office365.sharepoint.client_context import ClientContext
7284
73- ctx = ClientContext.connect_with_credentials(url, UserCredential(username, password))
85+ ctx = ClientContext(site_url).with_credentials( UserCredential(username, password))
7486request = RequestOptions("{0}/_api/web/".format(settings['url']))
7587response = ctx.execute_request_direct(request)
7688json = json.loads(response.content)
0 commit comments