Skip to content

Commit 20678f7

Browse files
committed
2 parents 1fc7c8f + 79f3753 commit 20678f7

File tree

3 files changed

+328
-13
lines changed

3 files changed

+328
-13
lines changed

README.md

Lines changed: 270 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,270 @@
1-
# microsoftgraph-python
1+
# microsoft-python
2+
Microsoft graph API wrapper for Microsoft Graph written in Python.
3+
4+
## Installing
5+
```
6+
git+git://github.com/GearPlug/microsoftgraph-python
7+
```
8+
9+
## Usage
10+
```
11+
from microsoftgraph.client import Client
12+
client = Client('CLIENT_ID', 'CLIENT_SECRET', account_type='by defect common')
13+
```
14+
15+
#### Get authorization url
16+
for office 365
17+
```
18+
url = client.authorization_url(redirect_uri, scope, state=None, office365=True)
19+
```
20+
for microsoft graph
21+
```
22+
url = client.authorization_url(redirect_uri, scope, state=None, office365=False)
23+
```
24+
25+
#### Exchange the code for an access token
26+
for office 365
27+
```
28+
token = client.exchange_code(redirect_uri, code, office365=True)
29+
```
30+
for microsoft graph
31+
```
32+
token = client.exchange_code(redirect_uri, code, office365=False)
33+
```
34+
35+
#### Refresh token
36+
for office 365
37+
```
38+
token = client.refresh_token(redirect_uri, refresh_token, office365=True)
39+
```
40+
for microsoft graph
41+
```
42+
token = client.refresh_token(redirect_uri, refresh_token, office365=False)
43+
```
44+
45+
#### Set token
46+
for office 365
47+
```
48+
token = client.set_token(token, office365=True)
49+
```
50+
for microsoft graph
51+
```
52+
token = client.set_token(token, office365=False)
53+
```
54+
55+
#### Get me
56+
```
57+
me = client.get_me()
58+
```
59+
60+
#### Get message
61+
```
62+
me = client.get_message(message_id="")
63+
```
64+
65+
### Webhook section, see the api documentation: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/webhooks
66+
67+
#### Create subscription
68+
```
69+
subscription = client.create_subscription(change_type, notification_url, resource, expiration_datetime, client_state=None)
70+
```
71+
72+
#### Renew subscription
73+
```
74+
renew = client.renew_subscription(subscription_id, expiration_datetime)
75+
```
76+
77+
#### Delete subscription
78+
```
79+
renew = client.delete_subscription(subscription_id)
80+
```
81+
82+
### Onenote section, see the api documentation: https://developer.microsoft.com/en-us/graph/docs/concepts/integrate_with_onenote
83+
84+
#### List notebooks
85+
```
86+
notebooks = client.list_notebooks()
87+
```
88+
89+
#### Get notebook
90+
```
91+
notebook = client.get_notebook(notebook_id)
92+
```
93+
94+
#### Get notebook sections
95+
```
96+
section_notebook = client.get_notebook_sections(notebook_id)
97+
```
98+
99+
#### Create page
100+
```
101+
add_page = client.create_page(section_id, files)
102+
```
103+
104+
#### List pages
105+
```
106+
pages = client.list_pages()
107+
```
108+
109+
### Calendar section, see the api documentation: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/calendar
110+
111+
#### Get events
112+
```
113+
events = client.get_me_events()
114+
```
115+
116+
#### Create calendar event
117+
```
118+
events = client.create_calendar_event(subject, content, start_datetime, start_timezone, end_datetime, end_timezone,
119+
recurrence_type, recurrence_interval, recurrence_days_of_week, recurrence_range_type,
120+
recurrence_range_startdate, recurrence_range_enddate, location, attendees, calendar=None)
121+
```
122+
123+
#### Get calendars
124+
```
125+
events = client.get_me_calendars()
126+
```
127+
128+
#### Create calendar
129+
```
130+
events = client.create_calendar(name)
131+
```
132+
133+
### Contacts section, see the api documentation: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/contact
134+
135+
#### Get contacts
136+
If you need a specific contact send the contact id in data_id
137+
```
138+
specific_contact = client.outlook_get_me_contacts(data_id="")
139+
```
140+
If you want all the contacts
141+
```
142+
specific_contact = client.outlook_get_me_contacts()
143+
```
144+
145+
#### Create contact
146+
```
147+
add_contact = client.outlook_create_me_contact()
148+
```
149+
150+
#### Create contact in specific folder
151+
```
152+
add_contact_folder = client.outlook_create_contact_in_folder(folder_id)
153+
```
154+
155+
#### Get contact folders
156+
```
157+
folders = client.outlook_get_contact_folders()
158+
```
159+
160+
#### Create contact folders
161+
```
162+
add_folders = client.outlook_create_contact_folder()
163+
```
164+
165+
### Onedrive section, see the api documentation: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/onedrive
166+
167+
#### Get root items
168+
```
169+
root_items = client.drive_root_items()
170+
```
171+
172+
#### Get root children items
173+
```
174+
root_children_items = client.drive_root_children_items()
175+
```
176+
177+
#### Get specific folder items
178+
```
179+
folder_items = client.drive_specific_folder(folder_id)
180+
```
181+
182+
### Excel section, see the api documentation: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/excel
183+
For use excel, you should know the folder id where the file is
184+
#### Create session for specific item
185+
```
186+
create_session = client.drive_create_session(item_id)
187+
```
188+
189+
#### Refresh session for specific item
190+
```
191+
refresh_session = client.drive_refresh_session(item_id)
192+
```
193+
194+
#### Close session for specific item
195+
```
196+
close_session = client.drive_close_session(item_id)
197+
```
198+
199+
#### Get worksheets
200+
```
201+
get_worksheets = client.excel_get_worksheets(item_id)
202+
```
203+
204+
#### Get specific worksheet
205+
```
206+
specific_worksheet = client.excel_get_specific_worksheet(item_id, worksheet_id)
207+
```
208+
209+
#### Add worksheets
210+
```
211+
add_worksheet = client.excel_add_worksheet(item_id)
212+
```
213+
214+
#### Update worksheet
215+
```
216+
update_worksheet = client.excel_update_worksheet(item_id, worksheet_id)
217+
```
218+
219+
#### Get charts
220+
```
221+
get_charts = client.excel_get_charts(item_id, worksheet_id)
222+
```
223+
224+
#### Add chart
225+
```
226+
add_chart = client.excel_add_chart(item_id, worksheet_id)
227+
```
228+
229+
#### Get tables
230+
```
231+
get_tables = client.excel_get_tables(item_id)
232+
```
233+
234+
#### Add table
235+
```
236+
add_table = client.excel_add_table(item_id)
237+
```
238+
239+
#### Add column to table
240+
```
241+
add_column = client.excel_add_column(item_id, worksheets_id, table_id)
242+
```
243+
244+
#### Add row to table
245+
```
246+
add_row = client.excel_add_row(item_id, worksheets_id, table_id)
247+
```
248+
249+
#### Get table rows
250+
```
251+
get_rows = client.excel_get_rows(item_id, table_id)
252+
```
253+
254+
#### Get range
255+
```
256+
get_range = client.excel_get_range(item_id, worksheets_id)
257+
```
258+
259+
#### Update range
260+
```
261+
update_range = client.excel_update_range(item_id, worksheets_id)
262+
```
263+
264+
## Requirements
265+
- requests
266+
267+
## Tests
268+
```
269+
test/test.py
270+
```

0 commit comments

Comments
 (0)