コード例 #1
0
ファイル: misc_tests.py プロジェクト: snovvcrash/peas
#print itemoperations_xmldoc_res

#FolderCreate
parent_folder = storage.get_folderhierarchy_folder_by_name("Inbox", curs)
new_folder = FolderHierarchy.Folder(
    parent_folder[0], "TestFolder1",
    str(FolderHierarchy.FolderCreate.Type.Mail))
foldercreate_xmldoc_req = FolderCreate.build(storage.get_synckey("0"),
                                             new_folder.ParentId,
                                             new_folder.DisplayName,
                                             new_folder.Type)
foldercreate_xmldoc_res = as_request("FolderCreate", foldercreate_xmldoc_req)
foldercreate_res_parsed = FolderCreate.parse(foldercreate_xmldoc_res)
if foldercreate_res_parsed[0] == "1":
    new_folder.ServerId = foldercreate_res_parsed[2]
    storage.insert_folderhierarchy_change(new_folder, curs)
    storage.update_synckey(foldercreate_res_parsed[1], "0", curs)
    conn.commit()
else:
    print as_status("FolderCreate", foldercreate_res_parsed[0])

time.sleep(5)

#FolderUpdate
old_folder_name = "TestFolder1"
new_folder_name = "TestFolder2"
#new_parent_id = parent_folder = storage.get_folderhierarchy_folder_by_name("Inbox", curs)
folder_row = storage.get_folderhierarchy_folder_by_name(old_folder_name, curs)
update_folder = FolderHierarchy.Folder(folder_row[1], new_folder_name,
                                       folder_row[3], folder_row[0])
folderupdate_xmldoc_req = FolderUpdate.build(storage.get_synckey("0"),
コード例 #2
0
itemoperations_params = [{"Name":"Fetch","Store":"Mailbox", "FileReference":"%34%67%32"}]
itemoperations_xmldoc_req = ItemOperations.build(itemoperations_params)
print "\r\nItemOperations Request:\r\n", itemoperations_xmldoc_req
#itemoperations_xmldoc_res, attachment_file = as_conn.fetch_multipart(itemoperations_xmldoc_req, "myattachment1.txt")
#itemoperations_xmldoc_res_parsed = ItemOperations.parse(itemoperations_xmldoc_res)
#print itemoperations_xmldoc_res

#FolderCreate
parent_folder = storage.get_folderhierarchy_folder_by_name("Inbox", curs)
new_folder = FolderHierarchy.Folder(parent_folder[0], "TestFolder1", str(FolderHierarchy.FolderCreate.Type.Mail))
foldercreate_xmldoc_req = FolderCreate.build(storage.get_synckey("0"), new_folder.ParentId, new_folder.DisplayName, new_folder.Type)
foldercreate_xmldoc_res = as_request("FolderCreate", foldercreate_xmldoc_req)
foldercreate_res_parsed = FolderCreate.parse(foldercreate_xmldoc_res)
if foldercreate_res_parsed[0] == "1":
    new_folder.ServerId = foldercreate_res_parsed[2]
    storage.insert_folderhierarchy_change(new_folder, curs)
    storage.update_synckey(foldercreate_res_parsed[1], "0", curs)
    conn.commit()
else:
    print as_status("FolderCreate", foldercreate_res_parsed[0])

time.sleep(5)

#FolderUpdate
old_folder_name = "TestFolder1"
new_folder_name = "TestFolder2"
#new_parent_id = parent_folder = storage.get_folderhierarchy_folder_by_name("Inbox", curs)
folder_row = storage.get_folderhierarchy_folder_by_name(old_folder_name, curs)
update_folder = FolderHierarchy.Folder(folder_row[1], new_folder_name, folder_row[3], folder_row[0])
folderupdate_xmldoc_req = FolderUpdate.build(storage.get_synckey("0"), update_folder.ServerId, update_folder.ParentId, update_folder.DisplayName)
folderupdate_xmldoc_res = as_request("FolderUpdate", folderupdate_xmldoc_req)