8d99756eff25b08b8697e8072723af4102698a2f
[tridge/openchange.git] / branches / plugfest / pyopenchange / tests / mapistore_test.py
1 #!/usr/bin/python
2
3 import sys
4
5 sys.path.append("python")
6
7 import os
8 import openchange
9 import openchange.mapistore as mapistore
10 from openchange import mapi
11
12 os.mkdir("/tmp/mapistore")
13
14 mapistore.set_mapping_path("/tmp/mapistore")
15 MAPIStore = mapistore.mapistore()
16 ctx_id = MAPIStore.add_context("fsocpf:///tmp/mapistore/0x0000000000010001")
17
18 SPropParent = mapi.SPropValue()
19 SPropParent.add(mapi.PR_FID, 0x0000000000010001)
20 SPropParent.add(mapi.PR_DISPLAY_NAME, "parent")
21 SPropParent.add(mapi.PR_COMMENT, "test parent")
22 SPropParent.add(mapi.PR_FOLDER_TYPE, 1)
23 MAPIStore.setprops(ctx_id, 0x0000000000010001, mapistore.MAPISTORE_FOLDER, SPropParent)
24
25 SPropValue = mapi.SPropValue()
26 SPropValue.add(mapi.PR_PARENT_FID, 0x0000000000010001)
27 SPropValue.add(mapi.PR_DISPLAY_NAME, "test")
28 SPropValue.add(mapi.PR_COMMENT, "test folder")
29 SPropValue.add(mapi.PR_FOLDER_TYPE, 1)
30
31 MAPIStore.mkdir(ctx_id, 0x0000000000010001, 0x0000000000020001, SPropValue)
32 MAPIStore.rmdir(ctx_id, 0x0000000000010001, 0x0000000000020001, mapistore.DEL_FOLDERS)
33
34 MAPIStore.del_context(ctx_id)
35