Skip to content

Commit f8da853

Browse files
committed
Update the docs
1 parent 586ea7b commit f8da853

File tree

13 files changed

+206
-103
lines changed

13 files changed

+206
-103
lines changed

docs/latest/_sources/usage/sharepoint.rst.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Sites.Read.All sharepoint To only read
1111
Sites.ReadWrite.All sharepoint_dl To read and save sites, lists and items
1212
========================= ======================================= =======================================
1313

14-
Note that using the *.All scopes is way less secure than granting permissions to specific sites and using
15-
Sites.Selected scope.
14+
Note that using the :code:`.All` scopes is way less secure than granting permissions to specific sites and using
15+
:code:`Sites.Selected scope`.
1616

1717
Assuming an authenticated account, create a Sharepoint instance, and connect
1818
to a Sharepoint site.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,53 @@
11
Query
22
=====
33

4+
.. _query_builder:
5+
46
Query Builder
57
-------------
68

9+
A query can be created for every ``ApiComponent`` (such as ``MailBox``). The ``Query`` can be used to handle the filtering, sorting, selecting, expanding and search very easily.
10+
11+
For example:
12+
13+
.. code-block:: python
14+
15+
from O365.utils import QueryBuilder
16+
builder = QueryBuilder(protocol=account.protocol)
17+
18+
query = builder.chain_or(builder.contains('subject', 'george best'), builder.startswith('subject', 'quotes')
19+
20+
# 'created_date_time' will automatically be converted to the protocol casing.
21+
# For example when using MS Graph this will become 'createdDateTime'.
22+
23+
query = query & builder.greater('created_date_time', datetime(2018, 3, 21))
24+
25+
print(query)
26+
27+
# contains(subject, 'george best') or startswith(subject, 'quotes') and createdDateTime gt '2018-03-21T00:00:00Z'
28+
# note you can pass naive datetimes and those will be converted to you local timezone and then send to the api as UTC in iso8601 format
29+
30+
# To use Query objetcs just pass it to the query parameter:
31+
filtered_messages = mailbox.get_messages(query=query)
32+
33+
You can also specify specific data to be retrieved with "select":
34+
35+
.. code-block:: python
36+
37+
# select only some properties for the retrieved messages:
38+
query = builder.select('subject', 'to_recipients', 'created_date_time)
39+
40+
messages_with_selected_properties = mailbox.get_messages(query=query)
41+
42+
You can also search content. As said in the graph docs:
43+
44+
You can currently search only message and person collections. A $search request returns up to 250 results. You cannot use $filter or $orderby in a search request.
45+
46+
If you do a search on messages and specify only a value without specific message properties, the search is carried out on the default search properties of from, subject, and body.
47+
48+
.. code-block:: python
49+
50+
# searching is the easy part ;)
51+
query = builder.search('george best is da boss')
52+
messages = mailbox.get_messages(query=query)
753

docs/latest/_sources/usage/utils/utils.rst.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ For example:
3939
4040
Query helper
4141
------------
42+
.. note::
43+
44+
This method of creating queries is now deprecated, queries shoould now be created using the ExperimentalQuery methods - :ref:`query_builder`
45+
4246
Every ``ApiComponent`` (such as ``MailBox``) implements a new_query method that will return a ``Query`` instance. This ``Query`` instance can handle the filtering, sorting, selecting, expanding and search very easily.
4347

4448
For example:

docs/latest/api/account.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
<li class="toctree-l4"><a class="reference internal" href="#O365.account.Account.connection"><code class="docutils literal notranslate"><span class="pre">Account.connection</span></code></a></li>
7474
<li class="toctree-l4"><a class="reference internal" href="#O365.account.Account.is_authenticated"><code class="docutils literal notranslate"><span class="pre">Account.is_authenticated</span></code></a></li>
7575
<li class="toctree-l4"><a class="reference internal" href="#O365.account.Account.main_resource"><code class="docutils literal notranslate"><span class="pre">Account.main_resource</span></code></a></li>
76-
<li class="toctree-l4"><a class="reference internal" href="#O365.account.Account.protocol"><code class="docutils literal notranslate"><span class="pre">Account.protocol</span></code></a></li>
7776
<li class="toctree-l4"><a class="reference internal" href="#O365.account.Account.username"><code class="docutils literal notranslate"><span class="pre">Account.username</span></code></a></li>
7877
</ul>
7978
</li>
@@ -417,12 +416,6 @@ <h1>Account<a class="headerlink" href="#account" title="Link to this heading">
417416
<dd><p>The resource in use for the account. <div style="line-height: 0; padding: 0; margin: 0"></div><div style="line-height: 0; padding: 0; margin: 0"></div>&nbsp;&nbsp; <strong>Type:</strong> str</p>
418417
</dd></dl>
419418

420-
<dl class="py attribute">
421-
<dt class="sig sig-object py" id="O365.account.Account.protocol">
422-
<span class="sig-name descname"><span class="pre">protocol</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="connection.html#O365.connection.Protocol" title="O365.connection.Protocol"><span class="pre">Protocol</span></a></em><a class="headerlink" href="#O365.account.Account.protocol" title="Link to this definition"></a></dt>
423-
<dd><p>The protocol to use for the account. Defaults ot MSGraphProtocol. <div style="line-height: 0; padding: 0; margin: 0"></div><div style="line-height: 0; padding: 0; margin: 0"></div>&nbsp;&nbsp; <strong>Type:</strong> Protocol</p>
424-
</dd></dl>
425-
426419
<dl class="py property">
427420
<dt class="sig sig-object py" id="O365.account.Account.username">
428421
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">username</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></em><a class="headerlink" href="#O365.account.Account.username" title="Link to this definition"></a></dt>

docs/latest/api/excel.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,10 +1952,8 @@ <h1>Excel<a class="headerlink" href="#excel" title="Link to this heading"></a
19521952
<dd><p>Updates the cells at a given range in this worksheet. This is a convenience method since there is no
19531953
direct endpoint API for tableless row updates.
19541954
:param str|Range address: the address to resolve to a range which can be used for updating cells.
1955-
:param list[list[str]] rows: list of rows to push to this range. If updating a single cell, pass a list</p>
1956-
<blockquote>
1957-
<div><p>containing a single row (list) containing a single cell worth of data.</p>
1958-
</div></blockquote>
1955+
:param list[list[str]] rows: list of rows to push to this range. If updating a single cell, pass a list
1956+
containing a single row (list) containing a single cell worth of data.</p>
19591957
</dd></dl>
19601958

19611959
<dl class="py attribute">

docs/latest/api/utils/token.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ <h1>Token<a class="headerlink" href="#token" title="Link to this heading"></a
444444

445445
<dl class="py attribute">
446446
<dt class="sig sig-object py" id="O365.utils.token.BaseTokenBackend.serializer">
447-
<span class="sig-name descname"><span class="pre">serializer</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">&lt;module</span> <span class="pre">'json'</span> <span class="pre">from</span> <span class="pre">'/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/json/__init__.py'&gt;</span></em><a class="headerlink" href="#O365.utils.token.BaseTokenBackend.serializer" title="Link to this definition"></a></dt>
447+
<span class="sig-name descname"><span class="pre">serializer</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">&lt;module</span> <span class="pre">'json'</span> <span class="pre">from</span> <span class="pre">'/opt/hostedtoolcache/Python/3.13.7/x64/lib/python3.13/json/__init__.py'&gt;</span></em><a class="headerlink" href="#O365.utils.token.BaseTokenBackend.serializer" title="Link to this definition"></a></dt>
448448
<dd></dd></dl>
449449

450450
</dd></dl>

0 commit comments

Comments
 (0)