public static PublicFolderSyncJobState StartSyncHierarchy(OrganizationId organizationId, Guid mailboxGuid, string serverFqdn, bool executeReconcileFolders = false) { ArgumentValidator.ThrowIfNull("organizationId", organizationId); ArgumentValidator.ThrowIfEmpty("mailboxGuid", mailboxGuid); ArgumentValidator.ThrowIfNull("server", serverFqdn); PublicFolderSyncJobState publicFolderSyncJobState; try { using (JobQueueRpcClient jobQueueRpcClient = new JobQueueRpcClient(serverFqdn)) { PublicFolderSyncJobRpcInParameters.PublicFolderSyncAction syncAction = executeReconcileFolders ? PublicFolderSyncJobRpcInParameters.PublicFolderSyncAction.StartSyncHierarchyWithFolderReconciliation : PublicFolderSyncJobRpcInParameters.PublicFolderSyncAction.StartSyncHierarchy; PublicFolderSyncJobRpcInParameters publicFolderSyncJobRpcInParameters = new PublicFolderSyncJobRpcInParameters(organizationId, mailboxGuid, syncAction); byte[] data = jobQueueRpcClient.EnqueueRequest(1, 1, publicFolderSyncJobRpcInParameters.Serialize()); EnqueueRequestRpcOutParameters enqueueRequestRpcOutParameters = new EnqueueRequestRpcOutParameters(data); PublicFolderSyncJobEnqueueResult publicFolderSyncJobEnqueueResult = enqueueRequestRpcOutParameters.Result as PublicFolderSyncJobEnqueueResult; if (publicFolderSyncJobEnqueueResult == null || publicFolderSyncJobEnqueueResult.PublicFolderSyncJobState == null) { throw new PublicFolderSyncPermanentException(ServerStrings.PublicFolderStartSyncFolderHierarchyRpcFailed); } publicFolderSyncJobState = publicFolderSyncJobEnqueueResult.PublicFolderSyncJobState; } } catch (RpcException innerException) { throw new PublicFolderSyncTransientException(ServerStrings.PublicFolderStartSyncFolderHierarchyRpcFailed, innerException); } catch (SerializationException innerException2) { throw new PublicFolderSyncPermanentException(ServerStrings.PublicFolderStartSyncFolderHierarchyRpcFailed, innerException2); } return(publicFolderSyncJobState); }
public static PublicFolderSyncJobState SyncFolder(OrganizationId organizationId, Guid mailboxGuid, string serverFqdn, byte[] folderId) { ArgumentValidator.ThrowIfNull("organizationId", organizationId); ArgumentValidator.ThrowIfEmpty("mailboxGuid", mailboxGuid); ArgumentValidator.ThrowIfNull("server", serverFqdn); ArgumentValidator.ThrowIfNull("folderId", folderId); ArgumentValidator.ThrowIfZeroOrNegative("folderId.Length", folderId.Length); PublicFolderSyncJobState publicFolderSyncJobState; try { using (JobQueueRpcClient jobQueueRpcClient = new JobQueueRpcClient(serverFqdn)) { PublicFolderSyncJobRpcInParameters publicFolderSyncJobRpcInParameters = new PublicFolderSyncJobRpcInParameters(organizationId, mailboxGuid, folderId); byte[] data = jobQueueRpcClient.EnqueueRequest(1, 1, publicFolderSyncJobRpcInParameters.Serialize()); EnqueueRequestRpcOutParameters enqueueRequestRpcOutParameters = new EnqueueRequestRpcOutParameters(data); PublicFolderSyncJobEnqueueResult publicFolderSyncJobEnqueueResult = enqueueRequestRpcOutParameters.Result as PublicFolderSyncJobEnqueueResult; if (publicFolderSyncJobEnqueueResult == null || publicFolderSyncJobEnqueueResult.PublicFolderSyncJobState == null) { throw new PublicFolderSyncPermanentException(ServerStrings.PublicFolderSyncFolderRpcFailed); } publicFolderSyncJobState = publicFolderSyncJobEnqueueResult.PublicFolderSyncJobState; } } catch (RpcException innerException) { throw new PublicFolderSyncTransientException(ServerStrings.PublicFolderSyncFolderRpcFailed, innerException); } catch (SerializationException innerException2) { throw new PublicFolderSyncPermanentException(ServerStrings.PublicFolderSyncFolderRpcFailed, innerException2); } return(publicFolderSyncJobState); }
public static EnqueueResult EnqueueTeamMailboxSyncRequest(string targetServer, Guid mailboxGuid, QueueType queueType, OrganizationId orgId, string clientString, string domainController, SyncOption syncOption = SyncOption.Default) { if (mailboxGuid == Guid.Empty) { throw new ArgumentNullException("mailboxGuid"); } if (orgId == null) { throw new ArgumentNullException("orgId"); } if (queueType != QueueType.TeamMailboxDocumentSync && queueType != QueueType.TeamMailboxMembershipSync && queueType != QueueType.TeamMailboxMaintenanceSync) { throw new ArgumentException("queueType"); } RpcClientWrapper.InitializeIfNeeded(); if (!RpcClientWrapper.instance.initialized) { return(new EnqueueResult(EnqueueResultType.ClientInitError, ClientStrings.RpcClientInitError)); } EnqueueResult result; try { using (JobQueueRpcClient jobQueueRpcClient = new JobQueueRpcClient(targetServer ?? RpcClientWrapper.instance.localServer.Fqdn)) { TeamMailboxSyncRpcInParameters teamMailboxSyncRpcInParameters = new TeamMailboxSyncRpcInParameters(mailboxGuid, orgId, clientString, syncOption, domainController); byte[] data = jobQueueRpcClient.EnqueueRequest(1, (int)queueType, teamMailboxSyncRpcInParameters.Serialize()); EnqueueRequestRpcOutParameters enqueueRequestRpcOutParameters = new EnqueueRequestRpcOutParameters(data); result = enqueueRequestRpcOutParameters.Result; } } catch (RpcException ex) { result = new EnqueueResult(EnqueueResultType.RpcError, ClientStrings.RpcClientRequestError(ex.Message)); } return(result); }