def getitemestimate_check_prime_collections(getitemestimate_responses): has_synckey = [] needs_synckey = {} for response in getitemestimate_responses: if response.Status == "1": has_synckey.append(response.CollectionId) elif response.Status == "2": print "GetItemEstimate Status: Unknown CollectionId (%s) specified. Removing." % response.CollectionId elif response.Status == "3": print "GetItemEstimate Status: Sync needs to be primed." needs_synckey.update({response.CollectionId:{}}) has_synckey.append(response.CollectionId) #technically *will* have synckey after do_sync() need end of function else: print as_status("GetItemEstimate", response.Status) if len(needs_synckey) > 0: do_sync(needs_synckey) return has_synckey, needs_synckey
def getitemestimate_check_prime_collections(getitemestimate_responses): has_synckey = [] needs_synckey = {} for response in getitemestimate_responses: if response.Status == "1": has_synckey.append(response.CollectionId) elif response.Status == "2": print "GetItemEstimate Status: Unknown CollectionId (%s) specified. Removing." % response.CollectionId elif response.Status == "3": print "GetItemEstimate Status: Sync needs to be primed." needs_synckey.update({response.CollectionId: {}}) has_synckey.append( response.CollectionId) #technically *will* have synckey after do_sync() need end of function else: print as_status("GetItemEstimate", response.Status) if len(needs_synckey) > 0: do_sync(needs_synckey) return has_synckey, needs_synckey
if do_apply_eas_policies(policydict): provision_xmldoc_req = Provision.build(policykey) provision_xmldoc_res = as_request("Provision", provision_xmldoc_req) status, policystatus, policykey, policytype, policydict, settings_status = Provision.parse( provision_xmldoc_res) if status == "1": as_conn.set_policykey(policykey) 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() collection_id_of = storage.get_folder_name_to_id_dict() INBOX = collection_id_of["Inbox"]
if do_apply_eas_policies(policydict): provision_xmldoc_req = Provision.build(policykey) provision_xmldoc_res = as_request("Provision", provision_xmldoc_req) status, policystatus, policykey, policytype, policydict, settings_status = Provision.parse( provision_xmldoc_res) if status == "1": as_conn.set_policykey(policykey) 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",
storage.update_keyvalue("X-MS-PolicyKey", policykey) storage.update_keyvalue("EASPolicies", repr(policydict)) if do_apply_eas_policies(policydict): provision_xmldoc_req = Provision.build(policykey) provision_xmldoc_res = as_request("Provision", provision_xmldoc_req) status, policystatus, policykey, policytype, policydict, settings_status = Provision.parse(provision_xmldoc_res) if status == "1": as_conn.set_policykey(policykey) 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
storage.update_keyvalue("X-MS-PolicyKey", policykey) storage.update_keyvalue("EASPolicies", repr(policydict)) if do_apply_eas_policies(policydict): provision_xmldoc_req = Provision.build(policykey) provision_xmldoc_res = as_request("Provision", provision_xmldoc_req) status, policystatus, policykey, policytype, policydict, settings_status = Provision.parse(provision_xmldoc_res) if status == "1": as_conn.set_policykey(policykey) 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() collection_id_of = storage.get_folder_name_to_id_dict() INBOX = collection_id_of["Inbox"] SENT_ITEMS = collection_id_of["Sent Items"]
storage.update_keyvalue("X-MS-PolicyKey", policykey) storage.update_keyvalue("EASPolicies", repr(policydict)) if do_apply_eas_policies(policydict): provision_xmldoc_req = Provision.build(policykey) provision_xmldoc_res = as_request("Provision", provision_xmldoc_req) status, policystatus, policykey, policytype, policydict, settings_status = Provision.parse(provision_xmldoc_res) if status == "1": as_conn.set_policykey(policykey) 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() collection_id_of = storage.get_folder_name_to_id_dict() INBOX = collection_id_of["Inbox"] SENT_ITEMS = collection_id_of["Sent Items"]