#FolderSync + Provision foldersync_xmldoc_req = FolderSync.build(storage.get_synckey("0")) foldersync_xmldoc_res = as_request("FolderSync", foldersync_xmldoc_req) changes, synckey, status = FolderSync.parse(foldersync_xmldoc_res) if int(status) > 138 and int(status) < 145: print as_status("FolderSync", status) do_provision() foldersync_xmldoc_res = as_request("FolderSync", foldersync_xmldoc_req) changes, synckey, status = FolderSync.parse(foldersync_xmldoc_res) if int(status) > 138 and int(status) < 145: print as_status("FolderSync", status) raise Exception( "Unresolvable provisoning error: %s. Cannot continue..." % status) if len(changes) > 0: storage.update_folderhierarchy(changes) storage.update_synckey(synckey, "0", curs) conn.commit() collection_id_of = storage.get_folder_name_to_id_dict() INBOX = collection_id_of["Inbox"] SENT_ITEMS = collection_id_of["Sent Items"] CALENDAR = collection_id_of["Calendar"] CONTACTS = collection_id_of["Contacts"] SUGGESTED_CONTACTS = collection_id_of["Suggested Contacts"] NOTES = collection_id_of["Notes"] TASKS = collection_id_of["Tasks"] collection_sync_params = { INBOX: { #"Supported":"",
storage.update_keyvalue("X-MS-PolicyKey", policykey) #FolderSync + Provision foldersync_xmldoc_req = FolderSync.build(storage.get_synckey("0")) foldersync_xmldoc_res = as_request("FolderSync", foldersync_xmldoc_req) changes, synckey, status = FolderSync.parse(foldersync_xmldoc_res) if int(status) > 138 and int(status) < 145: print as_status("FolderSync", status) do_provision() foldersync_xmldoc_res = as_request("FolderSync", foldersync_xmldoc_req) changes, synckey, status = FolderSync.parse(foldersync_xmldoc_res) if int(status) > 138 and int(status) < 145: print as_status("FolderSync", status) raise Exception("Unresolvable provisoning error: %s. Cannot continue..." % status) if len(changes) > 0: storage.update_folderhierarchy(changes) storage.update_synckey(synckey, "0", curs) conn.commit() #ItemOperations 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)